-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
60 lines (49 loc) · 1.2 KB
/
Board.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
53
54
55
56
57
58
59
60
#include <iostream>
#include <string>
#include <vector>
#include <random>
#ifndef BOARD_H
#define BOARD_H
const int N = 3;
class Board {
private:
Board* parent;
int depth;
std::string** board;
int board_utility;
std::vector<Board*> children;
int calc_depth();
void copy_board_obj(const Board&);
void set_depth();
void set_board_utility();
void copy_board(const Board&);
void copy_children(const Board&);
void allocate_memory();
void clear();
public:
Board();
Board(std::string**);
Board(std::string[N][N]);
Board(Board*);
Board(const Board&);
Board& operator=(const Board&);
~Board();
void generate_children(std::string);
std::string** get_board() const;
Board* get_parent() const;
int get_depth() const;
int get_utility() const;
std::vector<Board*> get_children() const;
int utility() const;
bool terminal_test() const;
bool test_move(int, int, std::string) const;
bool make_move(int, int, std::string);
bool x_wins() const;
void cross_x();
bool o_wins() const;
void cross_o();
Board* get_action(Board*, Board*);
void clear_children();
void print_state() const;
};
#endif