-
Notifications
You must be signed in to change notification settings - Fork 2
/
qtchess.h
163 lines (128 loc) · 2.32 KB
/
qtchess.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#ifndef _QTCHESS_
#define _QTCHESS_
/*
** -- Qt Includes --
*/
#include <QApplication>
/*
** -- Local Includes --
*/
#include "qtchess_gui.h"
#include "qtchess_comm.h"
#include "qtchess_defs.h"
#include "qtchess_validate.h"
class qtchess
{
public:
/*
** -- Members --
*/
int board[NSQUARES][NSQUARES];
/*
** -- Methods --
*/
qtchess(void)
{
int i = 0, j = 0;
for(i = 0; i < NSQUARES; i++)
for(j = 0; j < NSQUARES; j++)
board[i][j] = 0;
turn = -1;
first = -1;
my_color = -1;
}
int getTurn(void)
{
return turn;
}
int getFirst(void)
{
return first;
}
int getMyColor(void)
{
return my_color;
}
bool hasKingMoved(void)
{
return king_has_moved;
}
bool hasRook1Moved(void)
{
return rook1_has_moved;
}
bool hasRook2Moved(void)
{
return rook2_has_moved;
}
bool isGameOver(void)
{
return game_over;
}
bool wasPieceWon(void)
{
return wonPiece;
}
struct move_s getLastOpponentMove(void)
{
return last_opponent_move;
}
void setWonPiece(const bool wonPieceArg)
{
wonPiece = wonPieceArg;
}
void setLastOpponentMove(const struct move_s move)
{
last_opponent_move = move;
}
void setGameOver(const bool game_over_arg)
{
game_over = game_over_arg;
}
void setTurn(const int turn_arg)
{
turn = turn_arg;
}
void setFirst(const int first_arg)
{
first = first_arg;
}
void setMyColor(const int my_color_arg)
{
my_color = my_color_arg;
}
void setKingHasMoved(const bool king_has_moved_arg)
{
king_has_moved = king_has_moved_arg;
}
void setRook1HasMoved(const bool rook1_has_moved_arg)
{
rook1_has_moved = rook1_has_moved_arg;
}
void setRook2HasMoved(const bool rook2_has_moved_arg)
{
rook2_has_moved = rook2_has_moved_arg;
}
bool isReady(void);
bool isConnected(void);
void init(void);
void quit(const char *, const int);
void updateBoard(char *);
private:
/*
** -- Members --
*/
int turn;
int first;
int my_color;
bool wonPiece;
bool game_over;
bool king_has_moved;
bool rook1_has_moved;
bool rook2_has_moved;
struct move_s last_opponent_move;
/*
** -- Methods
*/
};
#endif