AStar in a specific case in C#
Posted
by KiTe
on Stack Overflow
See other posts from Stack Overflow
or by KiTe
Published on 2010-03-01T15:19:27Z
Indexed on
2010/05/17
4:10 UTC
Read the original article
Hit count: 409
Hello.
To an intership, I have use the A* algorithm in the following case :
- the unit shape is a square of height and width of 1,
- we can travel from a zone represented by a rectangle from another, but we can't travel outside these predifined areas,
- we can go from a rectangle to another through a door, represented by a segment on corresponding square edge.
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
© Stack Overflow or respective owner