54#ifndef __ADS_FifteenPuzzle
55 #define __ADS_FifteenPuzzle
81using Board = std::vector< int >;
132inline std::optional< std::vector< Board > >
134 long * visited =
nullptr );
161inline std::optional< std::vector< Board > >
218template<
class Map = std::map< Board ,
int > >
220 long * visited =
nullptr );
230#include "ADS/intractable/impl/FifteenPuzzle.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The PRIORITYQUEUE [see PriorityQueue.h] on a Fibonacci heap, the structure that section 11....
W manhattan(GridCell a, GridCell b, W straight=W(1))
the distance of Manhattan between the cells and , , the least cost of a path of moves to the sides o...
bool solvable(const Board &B, int n)
whether the goal can be reached from
std::vector< Board > puzzleMoves(const Board &B, int n)
the configurations one move away, the hole swapped with the tile above, below, on the left and on the...
Board puzzleSpiralGoal(int n)
the spiral goal on squares: the tiles clockwise from the top left corner, the hole where the spiral ...
std::optional< std::vector< Board > > puzzleDFS(const Board &B, const Board &goal, int n, int nmax)
the configurations from to goal of a solution of at most moves by the backtracking in depth,...
std::optional< std::vector< Board > > solvePuzzle(const Board &B, int n, long *visited=nullptr)
the configurations from to the goal of a shortest solution, or nothing; the number of nodes extracte...
Board puzzleGoal(int n)
the goal on squares, the tiles by rows and the hole last
std::vector< int > Board
a configuration: the tile of each square by rows, 0 the hole
Definition FifteenPuzzle.h:81
std::optional< std::vector< Board > > puzzleBFS(const Board &B, const Board &goal, int n, long *visited=nullptr)
the configurations from to goal of a shortest solution by the visit in breadth, or nothing if goal c...