# Should pathfinder in A* hold closedSet and openedSet or each object should hold its sets?

I am about to implement A* pathfinding algorithm and I wonder how should I implement this - from the point of view of architecture.

I have the pathfinder as a class - I think I will instantiate only one object of this class (or maybe make it a Singleton - this is not so important).

The hardest part for me is whether the closedSet and openedSet should be attached to objects that can find the path for them or should be stored in pathfinder class ?

I am opened to any hints and critique whatsoever.

What is the best practice considering pathfinding in terms of design ?

• Adding a "PathFinder" interface really doesn't require any extra time... Also, a note for OP: quite often the ClosedSet doesn't actually exist; the developer will instead add a HasBeenVisited property to the Node class. – BlueRaja - Danny Pflughoeft Dec 18 '12 at 16:34