Thomas KiTe Trentin
Thomas KiTe Trentin

Reputation: 600

AStar in a specific case in C#

To an intership, I have use the A* algorithm in the following case :

Here are the 2 things I already did but which didn't satisfied my boss :

1 : I created the following classes : -a Door class which contains the location of the 2 separated squares and the door's orientation (top, left, bottom, right), -a Map class which contains a door list, a rectangle list representing the walkable areas and a 2D array representing the ground's squares (for additionnal infomations through an enumeration) - classes for the A* algorithm (node, AStar)

2 : -a MapCase class, which contains information about the case effect and doors through an enumeration (with [FLAGS] attribute set on, to be able to cummulate several information on each case) -a Map classes which only contains a 2D array of MapCase classes - the classes for the A* algorithm (still node an AStar).

Since the 2 version is better than the first (less useless calculation, better map classes architecture), my boss is not still satisfied about my mapping classes architecture.

The A* and node classes are good and easily mainainable, so I don't think I have to explain them deeper for now.

So here is my asking : has somebody a good idea to implement the A* with the problem specification (rectangle walkable but with a square unit area, travelling through doors)?

He said that a grid vision of the problem (so a 2D array) shouldn't be the correct way to solve the problem.

I wish I've been clear while exposing my problem ..

Thanks

KiTe

Upvotes: 2

Views: 622

Answers (1)

sfg
sfg

Reputation: 489

Rather than a multi-dimensional array you could use nodes with weighted edges. This fits well as for the A* search you need the distances and connections. If the distancs are all 1 then you can ignore the weightings.

Upvotes: 1

Related Questions