Some questions with finding a way

I learned about A *, BFS, DFS and I am implementing them perfectly. However, some problems arise when I try to do this while solving the problem of finding a path. Suppose there are only two types of labyrinths: one has complete objects, since without an empty square, all this is either pacman, or item-to-collect or wall; and one has only a few elements (4 or less).

  • How exactly are BFS and DFS implemented if more than one item is collected? In this case, they still give the optimal result?

  • What is the best algorithm / heuristic for a full element map? What I have come up with so far is a bit of a greedy heuristic, but it is rather accidental because the card has too many items to collect and therefore is not a good idea to solve such a maze.

  • Using A * in a map with multiple elements, is there any good way to determine which element should be taken first? I was thinking of trying to use the Mahattan distance as a rough estimate, but that doesn't sound right, especially in some difficult situations.

+5
source share
2 answers

, . , , . . 1 , x, y pacman. , 3 , . 3 , , pacman . - , :

 ((x,y),FALSE,FALSE,FALSE) -> state that indicates that pacman has not eat any food
 ((x,y),FALSE,TRUE,FALSE) -> state that indicates that pacman has eat only one food
 ((x,y),TRUE,TRUE,TRUE) -> this is the goal state

, . BFS ans A * . , , . , . .

0

1) , BFS DFS , , , . , , , , "" , , .., , , - , , .

2) , , A *, ( , pacman ; , Pacman , . , , , , - :   ( )/( 3x3 )

3). , , , , manhattan . , 100% .

A * , , , .

, Pacman, http://en.wikipedia.org/wiki/Minimum_spanning_tree, , . : Kruskal vs Prim

0

All Articles