/
mainwindow.h
117 lines (77 loc) · 2.09 KB
/
mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "dialog.h"
#include "tictactoe.h"
#include "montebot.h"
#include "move.h";
#include "game.h"
#include "transmitter.h"
#include <string.h>
#include <iostream>
#include <QMainWindow>
#include <QPushButton>
#include <QDebug>
#include <QThread>
#include <QtConcurrent>
#include <QFuture>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
int player = 1; //Keeps track of current
explicit MainWindow(QWidget *parent = 0);
void setUpGrid();
void setChar(char);
void Play();
void CheckWinner(int currentGrid);
void colorBoard(int nextGrid, int move);
void colorBoardWin(int nextGrid,int player);
void colorBoardUltimateWin(int player);
void computer(int grid, int player);
~MainWindow();
//MonteCarlo
void computerMoves();
signals:
void turnComplete(int);
void computer_(int,int player);
public slots:
int itemClicked();
void humanMoves();
//void computer(int grid,int player);
void prediction(QString);
//For MonteBot
void wonBoard(int,int,int);
private slots:
void begin(int strength,bool mode);
void invalidMove();
void on_playAgain_clicked();
//For winbyone
void computerMove(int slot,int grid);
//For MonteBot
void computerMove(int board_row, int board_col, int cell_row, int cell_col);
void wonSlots(int board_row, int board_col, std::vector<Move>&);
private:
Ui::MainWindow *ui;
Dialog *options = new Dialog;
QPushButton *itemButtons[9][9];
QGridLayout *layouts[9];
QFrame *frames[9];
QPushButton *createButton(QString&, const QString/*const char**/);
TicTacToe *game = new TicTacToe();
int strength;
bool humanTurn;
int currentGrid = -1;
int nextGrid = -1;
int wonGrids[9] = {};
int previousMove[2] = {-1,-1}; //Stores currentGrid, move
int test = -1;
QThread *pthread = new QThread();
MonteBot montebot;
Game newgame;
Transmitter *transit = new Transmitter();
bool mode = false;
};
#endif // MAINWINDOW_H