Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

SgSearchValue Class Reference

Value used in search tasks derived from class SgSearch. More...

#include <SgSearchValue.h>

List of all members.

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

Detailed Description

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.


Member Enumeration Documentation

anonymous enum
Enumerator:
MAX_LEVEL 
MAX_VALUE 

The best possible search result - highest possible value.

A win in n ply is encoded with a value of MAX_VALUE - n. A loss is encoded as -value if the win would be encoded as value. MAX_VALUE==32000.

MIN_VALUE 

The worst possible search result.

All search results are in the range [MIN_VALUE..MAX_VALUE].

MAX_KO_LEVEL 

The maximum number of Ko recaptures allowed in a search.

KO_VALUE 

KO_VALUE is the result for win by ko.

Similarly with MAX_VALUE, a win by Ko in n ply is encoded as KO_VALUE - n. KO_VALUE==32000 - 256 = 31744.

MIN_PROVEN_VALUE 

MIN_PROVEN_VALUE is the lowest score that indicates a proven win.

1. values in the range [MIN_VALUE..-MIN_PROVEN_VALUE] are proven losses (possibly by ko). 2. values in the range [-MIN_PROVEN_VALUE+1..MIN_PROVEN_VALUE-1] are heuristic scores. 3. values in range [MIN_PROVEN_VALUE..MAX_VALUE] are proven wins (possibly by ko).

Definition at line 28 of file SgSearchValue.h.


Constructor & Destructor Documentation

SgSearchValue::SgSearchValue (  ) 

Definition at line 110 of file SgSearchValue.h.

SgSearchValue::SgSearchValue ( int  v  )  [explicit]

Definition at line 114 of file SgSearchValue.h.

References MAX_VALUE, and SG_ASSERT.

SgSearchValue::SgSearchValue ( SgBlackWhite  goodForPlayer,
int  depth 
)
SgSearchValue::SgSearchValue ( SgBlackWhite  goodForPlayer,
int  depth,
int  koLevel 
)

Member Function Documentation

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.


Member Data Documentation

int SgSearchValue::m_value [private]

The documentation for this class was generated from the following files:


Sun Mar 13 2011 Doxygen 1.7.1