-
Notifications
You must be signed in to change notification settings - Fork 0
/
puzzle_solver.h
52 lines (43 loc) · 1.22 KB
/
puzzle_solver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef PUZZLESOLVER_H
#define PUZZLESOLVER_H
#include <queue>
#include <vector>
#include <deque>
#include <set>
#include "board.h"
#include "puzzle_move.h"
#include "puzzle_heur.h"
#include "mylist.h"
#include "pmminlist.h"
class PuzzleSolver
{
public:
/** Typedef for the closed-list set. */
typedef std::set<Board *, BoardLessThan> BoardSet;
/** Constructor (makes a copy of the Board and stores it in _b */
PuzzleSolver(const Board &b);
/** Destructor */
~PuzzleSolver();
/** Run the A* search returning -1 if no solution exists or
* the number of moves in the solution
* @param ph Method of calculating h score
* @return -1 if no solution, number of move otherwise
*/
int run(PuzzleHeuristic *ph);
//int run();
/** Return the list of solution tile number */
deque<int> get_solution();
/** Return how many expansions were performed in the search
* @return Number of expansions
*/
int getNumExpansions();
private:
Board b_;
int expansions_;
//**** Declare a List to store your solutions sequence of tiles to move
//MyList<Board> solution;
std::deque<int> trace;
MyList<PuzzleMove*> garbage;
BoardSet closeList;
};
#endif