forked from joelthelion/uct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boardothello.h
53 lines (43 loc) · 1.34 KB
/
boardothello.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
#ifndef __BOARDOTHELLO__
#define __BOARDOTHELLO__
#include "board.h"
class MoveOthello : public Move {
friend class BoardOthello;
public:
MoveOthello(Token player); //cant play move
MoveOthello(Token player,Size column,Size row);
virtual bool compare(const Move& move) const;
virtual void print() const;
virtual Move *deepcopy() const;
private:
Size column;
Size row;
bool can_play;
};
class BoardOthello : public Board {
public:
BoardOthello(Size width=8,Size height=8);
virtual ~BoardOthello();
virtual Board *deepcopy() const;
virtual Move *parse_move_string(Token player,const char *string) const;
virtual void print() const;
inline virtual bool is_move_valid(const Move &move) const;
virtual Moves get_possible_moves(Token player) const;
virtual void play_move(const Move &move);
virtual bool play_random_move(Token player);
virtual Token check_for_win() const;
protected:
bool propagate(Token player, Size column, Size row, Size dcolumn, Size drow) const;
bool can_play_normal_move_at(Token player, Size column, Size row) const;
bool can_play_normal_moves(Token player) const;
Size switch_tokens(Token player,Size column, Size row, Size dcolumn, Size drow);
private:
Size player_1_score, player_2_score;
Size cant_play_count;
Size width;
Size height;
Size size,played_count;
Token *flat;
Token **tokens;
};
#endif