blob: 97a1bec0be881049f727cbb149da95937a481b89 (
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
48
49
50
51
|
//
// Created by thecharlesblake on 10/24/17.
//
#ifndef SOLVITAIRE_GAME_STATE_H
#define SOLVITAIRE_GAME_STATE_H
#include <vector>
#include <ostream>
#include <string>
#include <rapidjson/document.h>
#include "card.h"
#include "sol_rules.h"
#include "pile.h"
class game_state {
public:
// Create a game state representation from a JSON doc
game_state(const rapidjson::Document&);
// Do the same from a 'rules' object
game_state(int seed, const sol_rules&);
std::vector<game_state> get_next_legal_states();
// NOTE: will only be evaluated after get_next_legal_states() is called
bool is_solved() const;
std::ostream& print(std::ostream&) const;
friend bool operator==(const game_state&, const game_state&);
friend std::ostream& operator<< (std::ostream&, const game_state&);
private:
static std::vector<card> shuffled_deck(int, int);
void print_header(std::ostream&, const char*) const;
void print_foundations(std::ostream&) const;
void print_cells(std::ostream&) const;
void print_tableau_piles(std::ostream&) const;
void print_hole(std::ostream&) const;
std::vector<pile> tableau_piles;
std::vector<pile> cells;
std::vector<pile> foundations;
sol_rules rules;
pile hole;
};
#endif //SOLVITAIRE_GAME_STATE_H
|