blob: 9488dda3ebb3a53971362605bf7f4b1376d3dff2 (
plain) (
blame)
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
|
//
// Created by thecharlesblake on 10/24/17.
//
#ifndef SOLVITAIRE_SOLVER_H
#define SOLVITAIRE_SOLVER_H
#include <string>
#include <list>
#include <vector>
#include "../game/global_cache.h"
#include "../game/sol_rules.h"
class solver {
public:
global_cache cache;
struct node {
node(node*, game_state::move);
node* parent;
const game_state::move move;
std::list<node> children;
};
explicit solver(const game_state&);
bool run();
void print_solution() const;
int get_states_searched() const;
const node& get_search_tree() const;
private:
bool revert_to_last_node_with_children();
void add_children(std::vector<game_state::move>&);
void add_child(game_state::move);
const game_state init_state;
game_state state;
int states_searched;
node root;
node* current_node;
};
#endif //SOLVITAIRE_SOLVER_H
|