Solving The 8 Puzzle With A* Algorithm

后端 未结 3 1514
忘了有多久
忘了有多久 2021-02-03 11:11

I would like to solve/implement the 8 puzzle problem using the A* algorithm in Java. Am asking if someone can help me by explaining to me the steps i must follow to solve it. I

3条回答
  •  我在风中等你
    2021-02-03 11:39

    I'd begin with deciding how you want to represent the game board states, then implement the operators (eg. move (blank) tile up, move (blank) tile down, ...). Typically you will have a data structure to represent the open list (ie. those states discovered but as yet unexplored (ie. compared with goal state) and another for the closed list (ie. those states discovered and explored and found not to be the goal state). You seed the open list with the starting state, and repeatedly take the "next" state to be explored from the open list, apply the operators to it to generate new possible states and so on ...

    There is a tutorial I prepared many years ago at:

    http://www.cs.rmit.edu.au/AI-Search/

    It is far from the definitive word on state space searching though, it is simply an educational tool for those brand new to the concept.

提交回复
热议问题