-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.h
64 lines (53 loc) · 1.12 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
61
62
63
64
#ifndef BOARD_H
#define BOARD_H
#include "square.h"
#include <QWidget>
#include <QGridLayout>
#include <vector>
#include <QString>
enum Win {
PLAYING,
ROW1,
ROW2,
ROW3,
COL1,
COL2,
COL3,
DIAGDOWN,
DIAGUP,
JACK
};
class board : public QWidget
{
Q_OBJECT
public:
explicit board(QWidget *parent = 0);
void checkForWin();
int stateToInt(State state) const;
square* getSquare(int xPos, int yPos);
std::vector<int> getIntState() const;
signals:
void updateTurnHeader(QString string);
public slots:
void resetGame();
void vsComputer(bool option);
void squareClicked(int xPos, int yPos);
private:
std::vector<square*> m_squares;
std::vector<int> m_squareValues;
State m_winner;
State m_turn;
State m_lastStart;
bool m_vsComputer;
QGridLayout* squareGrid;
void nextTurn();
void displayWin();
Win m_winType;
void vectorToArray(int intArray[], std::vector<int> intVector) const;
void takeComputerTurn();
int m_turnCounter;
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
};
#endif // BOARD_H