-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlayerComputer.h
77 lines (60 loc) · 1.88 KB
/
PlayerComputer.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
#include "core/QPosition.h"
#include "core/SearchInfo.h"
#include "core/MVK.h"
#include "game/Player.h"
class CEvaluator;
class CCache;
class CMPCStats;
class CCalcParams;
//! Default information for CPlayerComputer construction
class CComputerDefaults {
public:
CComputerDefaults();
std::string sCalcParams;
char cEval, cCoeffSet;
CValue vContempts[2];
int iPruneEndgame, iPruneMidgame, nRandShifts[2];
u4 iEdmund;
u4 fsPrint, fsPrintOpponent;
int MinutesOrDepth() const;
static CValue FloatToContempt(double fContempt);
};
//! Computerized player of an othello game
class CPlayerComputer : public CPlayer {
public:
CEvaluator* eval;
CCache *caches[2];
bool fHasCachedPos[2];
CCalcParams *pcp;
CMPCStats *mpcs;
CComputerDefaults cd;
bool toot;
bool solved, hasBacktracked, fAverageTime;
bool fAnalyzingDeferred;
CValue solvedValue;
CPlayerComputer(const CComputerDefaults& acd);
CPlayerComputer() {}
virtual ~CPlayerComputer();
// game playing
virtual void StartMatch(const COsMatch& match);
virtual TCheatcode GetMoveAndTime(COsGame& game, int flags, COsMoveListItem& mli);
virtual TCheatcode GetMove(COsGame& game, int flags, COsMoveListItem& mli);
virtual void EndGame(const COsGame& game);
// Routine to get a move
void Clear();
CSearchInfo DefaultSearchInfo(bool fBlackMove, u4 fNeeds, double tRemaining, int iCache) const;
void GetChosen(const CSearchInfo& si, const CQPosition& pos, CMVK& chosen);
void Hint(const CQPosition& pos, int nBest);
// misc
static u4 LogCacheSize(CCalcParams* pcp, int iPrune);
int AdjustedHeight(const CQPosition& pos) const;
void SetContempt(bool fDrawsToBlack);
// information about the player
virtual bool IsHuman() const;
protected:
void SetParameters(const CQPosition& pos, int iCache);
void SetParameters(int iCache);
static int DefaultRandomness();
virtual CCache* GetCache(int iCache);
CQPosition posCached[2];
};