-
Notifications
You must be signed in to change notification settings - Fork 1
/
Player.h
84 lines (70 loc) · 2.28 KB
/
Player.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
#ifndef PLAYER_H
#define PLAYER_H
#define bestAction pair<double, Move>
#define INF 1e9+7
#include "Game.h"
#include "Move.h"
#include <vector>
using namespace std;
class Player
{
private:
/**
* Type of me
* Player 0 (1) or Player 1 (-1)
*/
int player;
/**
* How much depth to do min-max
*/
int minimaxDepth;
/**
* The Game state maintained by our player - TEMPORARY
*/
Game *game;
/**
* Timings
*/
double startTime;
double timeAlloted;
double timeSpent;
double timeRemaining;
int movesPlayed; // Moves played by our player
/**
* Returns the best Move to play from the current game state for current player
* hasMovedYet means in the calling history has the concerned player played a ring moving game
*/
bestAction maxValue(int depth, bool hasMovedYet, double alpha, double beta);
bestAction maxValuePlaceRing(int depth, bool hasMovedYet, double alpha, double beta);
bestAction maxValueMoveRing(int depth, bool hasMovedYet, double alpha, double beta);
bestAction maxValueRemoveRow(int depth, bool hasMovedYet, double alpha, double beta);
bestAction maxValueRemoveRing(int depth, bool hasMovedYet, double alpha, double beta);
/**
* Returns the best Move to play from the current game state for opponent player
*/
bestAction minValue(int depth, bool hasMovedYet, double alpha, double beta);
bestAction minValuePlaceRing(int depth, bool hasMovedYet, double alpha, double beta);
bestAction minValueMoveRing(int depth, bool hasMovedYet, double alpha, double beta);
bestAction minValueRemoveRow(int depth, bool hasMovedYet, double alpha, double beta);
bestAction minValueRemoveRing(int depth, bool hasMovedYet, double alpha, double beta);
/**
* Takes in input for the opponent's move
* Processes the move and play's the move in our game state
*/
void playOpponentMove();
public:
/**
* @Constructor
* Input: Player 0 (1) or Player 1 (-1)
*/
Player(int playerType, int numRings, double totatTime, double currentTime);
/**
* Game playing function
*/
void playGame();
/**
* Updating timers and game strategy
*/
void updateGameStrategy(double beginTime);
};
#endif // PLAYER_H