Value used in search tasks derived from class SgSearch. More...
#include <SgSearchValue.h>
Public Types | |
enum | { MAX_LEVEL = 125, MAX_VALUE = MAX_LEVEL * SgSearch::MAX_DEPTH, MIN_VALUE = -MAX_VALUE, MAX_KO_LEVEL = 3, KO_VALUE = MAX_VALUE - SgSearch::MAX_DEPTH, MIN_PROVEN_VALUE } |
Public Member Functions | |
SgSearchValue () | |
SgSearchValue (int v) | |
SgSearchValue (SgBlackWhite goodForPlayer, int depth) | |
SgSearchValue (SgBlackWhite goodForPlayer, int depth, int koLevel) | |
operator int () const | |
Return current value as an integer. | |
int | Depth () const |
bool | FromString (const std::string &s) |
Convert 'string' to a value and set this value. | |
bool | IsEstimate () const |
bool | IsKoValue () const |
bool | IsPositive () const |
bool | IsSureValue () const |
int | KoLevel () const |
void | SetValueForPlayer (SgBlackWhite player) |
int | ValueForBlack () const |
int | ValueForPlayer (SgBlackWhite player) const |
int | ValueForWhite () const |
std::string | ToString (int unitPerPoint=1) const |
Set '*s' to the string for this value, e.g. | |
Static Public Member Functions | |
static bool | IsSolved (int value) |
is value == +MAX_VALUE or -MAX_VALUE? | |
Private Attributes | |
int | m_value |
Value used in search tasks derived from class SgSearch.
There's a range of values that indicate that the problem has been solved (at a certain depth), a range of values for solutions that involve ko, and a range of values for problems that have not been solved yet. Value is always stored with positive values being good for black, negative values being good for white.
int v = Board().ToPlay() == SG_WHITE ? -value : +value;
Definition at line 25 of file SgSearchValue.h.
anonymous enum |
Definition at line 28 of file SgSearchValue.h.
SgSearchValue::SgSearchValue | ( | ) |
Definition at line 110 of file SgSearchValue.h.
SgSearchValue::SgSearchValue | ( | int | v | ) | [explicit] |
Definition at line 114 of file SgSearchValue.h.
SgSearchValue::SgSearchValue | ( | SgBlackWhite | goodForPlayer, | |
int | depth | |||
) |
Definition at line 120 of file SgSearchValue.h.
References Depth(), KoLevel(), SgSearch::MAX_DEPTH, SetValueForPlayer(), SG_ASSERT, and SG_ASSERT_BW.
SgSearchValue::SgSearchValue | ( | SgBlackWhite | goodForPlayer, | |
int | depth, | |||
int | koLevel | |||
) |
Definition at line 131 of file SgSearchValue.h.
References Depth(), KoLevel(), SgSearch::MAX_DEPTH, MAX_KO_LEVEL, SetValueForPlayer(), SG_ASSERT, and SG_ASSERT_BW.
int SgSearchValue::Depth | ( | ) | const |
Definition at line 148 of file SgSearchValue.h.
References IsEstimate(), m_value, and SgSearch::MAX_DEPTH.
Referenced by SgSearchValue(), and ToString().
bool SgSearchValue::FromString | ( | const std::string & | s | ) |
Convert 'string' to a value and set this value.
Return true if the string could be converted to a valid value, otherwise false.
Definition at line 48 of file SgSearchValue.cpp.
References SG_ASSERT, and SG_UNUSED().
bool SgSearchValue::IsEstimate | ( | ) | const |
Definition at line 156 of file SgSearchValue.h.
References m_value, and MIN_PROVEN_VALUE.
Referenced by Depth(), KoLevel(), and ToString().
bool SgSearchValue::IsKoValue | ( | ) | const |
Definition at line 161 of file SgSearchValue.h.
References IsSureValue(), KO_VALUE, and m_value.
bool SgSearchValue::IsPositive | ( | ) | const |
Definition at line 166 of file SgSearchValue.h.
References m_value.
bool SgSearchValue::IsSolved | ( | int | value | ) | [static] |
is value == +MAX_VALUE or -MAX_VALUE?
Definition at line 176 of file SgSearchValue.h.
Referenced by SgSearch::SearchEngine().
bool SgSearchValue::IsSureValue | ( | ) | const |
Definition at line 171 of file SgSearchValue.h.
References m_value, and MIN_PROVEN_VALUE.
Referenced by IsKoValue().
int SgSearchValue::KoLevel | ( | ) | const |
Definition at line 55 of file SgSearchValue.cpp.
References IsEstimate(), m_value, SgSearch::MAX_DEPTH, and MAX_LEVEL.
Referenced by SgSearchValue(), and ToString().
SgSearchValue::operator int | ( | ) | const |
Return current value as an integer.
Definition at line 143 of file SgSearchValue.h.
References m_value.
void SgSearchValue::SetValueForPlayer | ( | SgBlackWhite | player | ) |
Definition at line 181 of file SgSearchValue.h.
References m_value, and SG_WHITE.
Referenced by SgSearchValue().
string SgSearchValue::ToString | ( | int | unitPerPoint = 1 |
) | const |
Set '*s' to the string for this value, e.g.
Set '*s' to the string for this value.
"B+3.5", "W+20", or "W+(ko)[12]". The value is divided by 'unitPerPoint' to determine the number of points.
e.g. "B+3.5", "W+20", or "W+(ko)[12]". The value is divided by 'unitPerPoint' to determine the number of points.
Definition at line 22 of file SgSearchValue.cpp.
References Depth(), IsEstimate(), KoLevel(), and m_value.
int SgSearchValue::ValueForBlack | ( | ) | const |
Definition at line 187 of file SgSearchValue.h.
References m_value.
int SgSearchValue::ValueForPlayer | ( | SgBlackWhite | player | ) | const |
Definition at line 192 of file SgSearchValue.h.
References m_value, SG_ASSERT_BW, and SG_WHITE.
int SgSearchValue::ValueForWhite | ( | ) | const |
Definition at line 198 of file SgSearchValue.h.
References m_value.
int SgSearchValue::m_value [private] |
Definition at line 107 of file SgSearchValue.h.
Referenced by Depth(), IsEstimate(), IsKoValue(), IsPositive(), IsSureValue(), KoLevel(), operator int(), SetValueForPlayer(), ToString(), ValueForBlack(), ValueForPlayer(), and ValueForWhite().