-
Notifications
You must be signed in to change notification settings - Fork 0
/
tictactoe.h
68 lines (55 loc) · 1.79 KB
/
tictactoe.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
/*
A Simple Tic-Tac-Toe game
Copyright (C) 2015 Mark Fitch
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef tictactoe_H
#define tictactoe_H
#include <QtGui/QMainWindow>
#include <QtGui/QPushButton>
namespace Ui{
class tictactoe;
}
class tictactoe : public QMainWindow
{
Q_OBJECT
public:
tictactoe();
virtual ~tictactoe();
private slots:
void on_btnTL_clicked();
void on_btnTC_clicked();
void on_btnTR_clicked();
void on_btnML_clicked();
void on_btnMC_clicked();
void on_btnMR_clicked();
void on_btnBL_clicked();
void on_btnBC_clicked();
void on_btnBR_clicked();
void on_btnNew_clicked();
private:
enum boardSpaces_t {TL, TC, TR, ML, MC, MR, BL, BC, BR};
enum spaceState_t {enable, disable};
enum gameState_t {pending, winner, tie};
gameState_t gameState;
static QString chrPlayerMarker[];
Ui::tictactoe *ui;
QPushButton *GameSpaces[9];
int intPlayerMoves[9];
int intCurrentPlayer;
static const int intWinningCombos[];
void InitGame();
void PlayerMove(boardSpaces_t);
void ToggleGameSpaces(spaceState_t);
};
#endif // tictactoe_H