-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.h
98 lines (81 loc) · 1.67 KB
/
constants.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
#ifndef CONSTANTS_H
#define CONSTANTS_H
#include <QObject>
#include <iostream>
#include <string>
#include <QQuickItem>
#include <QQmlEngine>
#define SIZE 12
#define BOARD_SIZE (SIZE*SIZE)
#define CENTER (SIZE /2 -1)
#define ROWS 12
#define COLS 12
using namespace std;
typedef struct move {
int i, j;
move () {
}
move (int a, int b) {
i = a;
j = b;
}
}Move;
typedef struct best {
Move bestMove;
int score;
best () {
}
best (Move m ,int s) {
bestMove.i = m.i;
bestMove.j = m.j;
score = s;
}
}Best;
class Constants : public QObject
{
Q_OBJECT
Q_PROPERTY(int rowNumber READ rowNumber )
Q_PROPERTY(int colNumber READ colNumber )
public:
static const int board_size = BOARD_SIZE;
static const int myrowNumber = SIZE;
static const int mycolNumber = SIZE;
static int const rowNumber(){return myrowNumber;}
static int const colNumber(){return mycolNumber;}
Q_ENUMS(color)
enum color{
BLANK,
WHITE,
BLACK,
POSSIBLE
};
enum gameType{
PLAYER_VS_PLAYER,
PLAYER_VS_PC,
PC_VS_PC
};
enum algorithm{
NONE,
MINIMAX,
ALPHA_BETA,
BOTH
};
enum playerType{
HUMAN,
PC
};
static Constants * m_Instance;
static Constants *getInstance(){
if (! m_Instance)
return new Constants();
return m_Instance;
}
static void QmlDec()
{
qmlRegisterType<Constants>("reversi", 1, 0, "Constants");
}
explicit Constants(QObject *parent = 0);
signals:
public slots:
};
#endif // CONSTANTS_H