Search algorithms for the 8-puzzle solution
|
8-puzzle exploration based on a breadth-first search strategy More...
#include <BreadthFirstSolver.hpp>
Public Member Functions | |
LinkedList< GameState * > | solve (Game &game, GameState &g0) |
Explores the game tree in search of the goal state. More... | |
![]() | |
double | getSecondsToSolve () const |
int | getVisitedNodes () const |
int | getMaxDepth () const |
int | getSolutionDepth () const |
bool | isSolved () |
Solver () | |
string | to_string () |
Generates a string containing useful information from the solver run. More... | |
Additional Inherited Members | |
![]() | |
bool | isVisited (GameState &g) |
Checks whether a node has already been visited by the solver. More... | |
LinkedList< GameState * > | visit (GameState *current) |
LinkedList< GameState * > | visit (GameState *current, bool keepVisited) |
Visit a game state, adding it to the list of visited states and returning its valid child states. More... | |
LinkedList< GameState * > | endSearch (GameState *currentGame, const clock_t start) |
End the search, generating the steps from the initial state to the goal. More... | |
![]() | |
OrderedList< GameState * > | visited = OrderedList<GameState *>(compare) |
int | visitedNodes |
int | maxDepth |
int | solutionDepth |
float | secondsToSolve |
bool | solved |
8-puzzle exploration based on a breadth-first search strategy
Definition at line 14 of file BreadthFirstSolver.hpp.
Explores the game tree in search of the goal state.
Exploration is done by applying one of the four valid actions of the 8-puzzle to intermediate, non-goal states until the goal state is reached.
g | A description of the game. |
gs | The initial state of the game. |
Implements Solver.
Definition at line 17 of file BreadthFirstSolver.hpp.