-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAI.hpp
95 lines (71 loc) · 1.5 KB
/
AI.hpp
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
/*
* AI.hpp
*
* Created on: Aug 23, 2012
* Author: msinclair94
*/
#pragma once
#ifndef AI_HPP_
#define AI_HPP_
#include <utility>
#include <vector>
#include <memory>
#include "BitBoard.hpp"
#include "Save.hpp"
#include "Game.hpp"
class BaseAI {
public:
// virtual void print_scene() = 0;
virtual Move get_random_move() const = 0;
virtual Move evaluate_game(Game&) = 0;
virtual ~BaseAI() {};
};
class SimpleAI : public BaseAI {
public:
friend class GameMaster;
SimpleAI(const unsigned level = 0, const Save& = Save(), const unsigned difficulty = 6);
~SimpleAI();
void print_scene();
Move get_random_move() const;
Move evaluate_game(Game&);
void difficulty(unsigned difficulty)
{
mDifficulty = difficulty;
}
unsigned difficulty() const
{
return mDifficulty;
}
private:
SimpleAI(const SimpleAI&);
SimpleAI& operator=(const SimpleAI&);
void generateMovesBlack();
void generateMovesWhite();
void generateMoves() {
if (sGame.mTurn)
generateMovesBlack();
else
generateMovesWhite();
}
void generateJumpsBlack();
void generateJumpsWhite();
void generateJumps() {
if (sGame.mTurn)
generateJumpsBlack();
else
generateJumpsWhite();
}
unsigned generateOutcomes();
Move evaluateMoves(bool aggro = false);
void updateScores(bool turn);
void initialize(const Save&);
unsigned mLevel;
unsigned mDifficulty;
std::vector<SimpleAI *> mChildren;
std::vector<Move> mMoves;
Save mSave;
float mAvgScore;
// float mP2Avg;
static Game sGame;
};
#endif /* AI_HPP_ */