-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnacengine.h
62 lines (42 loc) · 1.18 KB
/
nacengine.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
#ifndef NACENGINE_H
#define NACENGINE_H
#include <QObject>
// Game engine
class NACEngine : public QObject {
Q_OBJECT
private:
// Game field data
unsigned char* data;
// Winning line data
unsigned int* winData;
// Game step count
unsigned int step;
// User determinant
// If true Player 1 is Nought and
// Player 2 - Cross. Else backward
bool determinant;
public:
// Default c-tor
NACEngine();
// Refresh game field
Q_INVOKABLE void refreshField();
// Cell[x, y] on game field was clicked
Q_INVOKABLE bool cellClicked(unsigned int, unsigned int);
// Get player id whose move now
Q_INVOKABLE int getPlayer() const;
// Set players determinant
Q_INVOKABLE void setDeterminant(bool det);
// Get players determinant
Q_INVOKABLE bool getDeterminant() const;
// Check result
Q_INVOKABLE bool checkResult();
// Get step counter
Q_INVOKABLE unsigned int getStep() const;
// Get win data
Q_INVOKABLE unsigned int getWinData(unsigned int) const;
// Get game data
Q_INVOKABLE unsigned int getData(unsigned int) const;
// D-tor
~NACEngine();
};
#endif // NACENGINE_H