How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

后端 未结 9 953
春和景丽
春和景丽 2021-02-02 15:35

I\'ve read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known \"15-puzzle\".

C

相关标签:
9条回答
  • 2021-02-02 15:55

    A good heuristic for A-Star with the 15 puzzle is the number of squares that are in the wrong location. Because you need at least 1 move per square that is out of place, the number of squares out of place is guaranteed to be less than or equal to the number of moves required to solve the puzzle, making it an appropriate heuristic for A-Star.

    0 讨论(0)
  • 2021-02-02 15:58

    Also. be mindful that with the A-Star algorithm, at least, you will need to figure out a admissible heuristic to determine whether a possible next step is closer to the finished route than another step.

    0 讨论(0)
  • 2021-02-02 16:01

    Just use the game tree. Remember that a tree is a special form of graph.

    In your case the leaves of each node will be the game position after you make one of the moves that is available at the current node.

    0 讨论(0)
提交回复
热议问题