[go: up one dir, main page]

Menu

[r74]: / trunk / rlgo / RlState.cpp  Maximize  Restore  History

Download this file

74 lines (63 with data), 1.5 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//----------------------------------------------------------------------------
/** @file RlState.cpp
See RlState.h
*/
//----------------------------------------------------------------------------
#include "SgSystem.h"
#include "RlState.h"
using namespace std;
//----------------------------------------------------------------------------
RlState::RlState()
: m_timestep(-1),
m_colour(SG_EMPTY),
m_move(SG_NULLMOVE),
m_policyType(POL_NONE),
m_evaluated(false),
m_activeSet(false),
m_terminal(false)
{
ClearBest();
}
RlState::RlState(int timestep, SgBlackWhite colour)
: m_timestep(timestep),
m_colour(colour),
m_move(SG_NULLMOVE),
m_policyType(POL_NONE),
m_evaluated(false),
m_activeSet(false),
m_terminal(false)
{
ClearBest();
}
void RlState::Resize(int activesize)
{
m_active.Resize(activesize);
}
inline void RlState::ClearBest()
{
// @todo: not strictly necessary, but makes debugging clearer
m_bestMove = SG_NULLMOVE;
m_bestEval = 0;
}
bool RlState::OnPolicy() const
{
switch (m_policyType)
{
case POL_ON:
return true;
case POL_OFF:
return false;
case POL_BEST:
return m_move == m_bestMove;
case POL_TERMINAL:
return true;
default:
return true;
}
}
void RlState::CopyBest(const RlState& sourcestate)
{
m_bestMove = sourcestate.m_bestMove;
m_bestEval = sourcestate.m_bestEval;
}
//----------------------------------------------------------------------------