-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.h
More file actions
54 lines (48 loc) · 1.07 KB
/
player.h
File metadata and controls
54 lines (48 loc) · 1.07 KB
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
#pragma once
#include "board.h"
#include <QWidget>
#include <QApplication>
#include <QTime>
class Board;
struct Move
{
int from;
int to;
};
class Player :public QObject
{
Q_OBJECT
protected:
Board *board;
Color color;
bool canMove = true;/*information about whether it is Player`s turn to move or not*/
public:
Player(Color c);
virtual ~Player() = default;
virtual void move() = 0;
bool getCanMove(){return canMove;}
void setCanMove(bool canMove){this->canMove = canMove;}
Color getColor(){return color;}
void setBoard(Board* pBoard){board = pBoard;}
virtual bool isBot() = 0;
};
class Person : public Player
{
public:
Person(Color c);
void move() override;
void setBoardActive();
bool isBot()override {return false;}
};
class Bot : public Player
{
public:
Bot( Color c);
void move() override;
void setBoardActive();
void setBoardUnactive();
Move easythink();/*AI*/
Move hardThink();
int minimax(Board* board, int depth, bool maximizer);
bool isBot()override {return true;}
};