-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
executable file
·95 lines (58 loc) · 1.66 KB
/
Game.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
//
// Created by ben on 27/03/2020.
//
#ifndef DARTS501_GAME_H
#define DARTS501_GAME_H
#include <array>
#include "Player.h"
#include "Target.h"
typedef unsigned int uint;
using namespace std;
class Game {
protected:
Player _player1;
Player _player2;
uint _iterations = 0;
ushort _board[20] = {
20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5
};
bool _firstThrower = true;
vector<array<uint, 2>> _matches;
void SimulateMatch();
void SimulateSet();
void SimulateGame();
void PlayMatch();
void PlaySet();
void PlayGameUvsCPU();
void PlayGameUvsU();
ushort p1GameWins = 0;
ushort p2GameWins = 0;
ushort p1SetWins = 0;
ushort p2SetWins = 0;
static bool IsPossibleScore(ushort input);
static Target calcRange(short range);
static bool IsSimulation(Player, Player);
bool IsPlayerVsAI();
bool _aiAdvanced;
public:
Game() {}
Game(Player player1, Player player2, uint iterations, bool firstThrower,bool aiAdvanced) {
_player1 = std::move(player1);
_player2 = std::move(player2);
_iterations = iterations;
_firstThrower = firstThrower;
_aiAdvanced = aiAdvanced;
}
void Start();
void SimulateThrowAt(Target, Player &);
Player PlayThrowAt(Target, Player);
static Target CalculateTarget(short);
Player SimulateTurn(Player player);
string GetReport();
Player PlayTurn(Player player);
Player SimulateTurnVsU(Player player);
void PlayClearScreen();
bool isAiAdvanced() const;
Target SimpleCalculateTarget(short currentScore);
};
#endif //DARTS501_GAME_H