Belofte version 2.1.8
A promising chess program using the UCI or Winboard interface
bGame Class Referencefinal

game representation, singleton More...

#include <game.h>

+ Inheritance diagram for bGame:
+ Collaboration diagram for bGame:

Public Member Functions

 bGame ()
 
 ~bGame () override
 
 bGame (bGame const &)=delete
 
 bGame (bGame &&)=delete
 
bGameoperator= (bGame const &)=delete
 
bGameoperator= (bGame &&)=delete
 
 operator std::string () const
 
void newGame ()
 
void setFEN (std::string const &fenstr)
 
void setFENInitialPos ()
 
bool playGameMove (bCoordMove const &coordmove)
 
bool playGameMoveSeries (std::string const &coordmoves)
 all moves in a single string
 
void revertGameMove ()
 required for Winboard protocol, not supported in UCI (except debug)
 
std::string getResult (gameResult_t rs) const
 
void setResult (gameResult_t rs)
 
gameResult_t getResult () const
 
void setExpecting (std::string const &s)
 Following command should return value as expected.
 
bool isExpecting (std::string const &s) const
 
std::string const & getExpecting () const
 
bEpdResult evalEpdPosition (bFen const &fen, bEpdOpCodes &opcodes)
 do actual epd position test
 
bEpdResult evalPerftResult (bFen const &fen, bEpdOpCodes &opcodes)
 check perft result for different depths D[1-99] # perft test - nodes
 
bBoardgetCurrentPosition ()
 
void setLevel (bLevel const &l)
 
bLevelgetLevel ()
 
positions_tgetPositions ()
 
void setPlayerName (std::string const &n)
 
void DoSearch ()
 Start search thread and exit in case of batch mode, will wait until end of search.
 
void AbortSearch ()
 
void WaitForSearchEnd ()
 Called in separate thread, sure to terminate normally.
 
int64_t DoPerft (bSearchAlgorithm &sa, int const d)
 do perft search at depth
 
bScore EvalForPlayer (bBoard const &b)
 
gameResult_t EvalFinalScore (bBoard const &b)
 
- Public Member Functions inherited from bConfigurableGame
 bConfigurableGame ()
 
virtual ~bConfigurableGame ()
 
 bConfigurableGame (bConfigurableGame const &)=delete
 
bConfigurableGameoperator= (bConfigurableGame const &)=delete
 
 bConfigurableGame (bConfigurableGame &&)=delete
 
bConfigurableGameoperator= (bConfigurableGame &&)=delete
 
void setAlgorithm (std::string const &alg)
 
bSearchAlgorithmgetAlgorithm () const
 
void setEval (std::string const &e)
 
bPositionEvaluationgetEval () const
 

Detailed Description

game representation, singleton

Definition at line 20 of file game.h.

Constructor & Destructor Documentation

◆ bGame() [1/3]

bGame::bGame ( )

Definition at line 15 of file game.cpp.

+ Here is the call graph for this function:

◆ ~bGame()

bGame::~bGame ( )
override

Definition at line 24 of file game.cpp.

◆ bGame() [2/3]

bGame::bGame ( bGame const &  )
delete

◆ bGame() [3/3]

bGame::bGame ( bGame &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

bGame & bGame::operator= ( bGame const &  )
delete

◆ operator=() [2/2]

bGame & bGame::operator= ( bGame &&  )
delete

◆ operator std::string()

bGame::operator std::string ( ) const
Todo:
Look at using stream and << operator instead of std::string

Definition at line 359 of file game.cpp.

◆ newGame()

void bGame::newGame ( )

Definition at line 28 of file game.cpp.

Referenced by bGame(), evalEpdPosition(), evalPerftResult(), cmd_ucinewgame::execute(), cmd_bench::execute(), cmd_new::execute(), main(), and bel_debug::run_bench().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFEN()

void bGame::setFEN ( std::string const &  fenstr)

Definition at line 54 of file game.cpp.

Referenced by evalEpdPosition(), evalPerftResult(), cmd_position::execute(), cmd_setboard::execute(), and bel_debug::run_bench().

+ Here is the caller graph for this function:

◆ setFENInitialPos()

void bGame::setFENInitialPos ( )

Definition at line 46 of file game.cpp.

Referenced by cmd_position::execute(), cmd_bench::execute(), cmd_new::execute(), main(), and bel_debug::run_bench().

+ Here is the caller graph for this function:

◆ playGameMove()

bool bGame::playGameMove ( bCoordMove const &  coordmove)

Definition at line 208 of file game.cpp.

Referenced by WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ playGameMoveSeries()

bool bGame::playGameMoveSeries ( std::string const &  coordmoves)

all moves in a single string

Returns
false if one move cannot be played

Definition at line 200 of file game.cpp.

◆ revertGameMove()

void bGame::revertGameMove ( )

required for Winboard protocol, not supported in UCI (except debug)

Definition at line 237 of file game.cpp.

Referenced by cmd_undo::execute(), cmd_remove::execute(), and cmd_again::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResult() [1/2]

std::string bGame::getResult ( gameResult_t  rs) const

Definition at line 183 of file game.cpp.

Referenced by engineInterface::sendResult().

+ Here is the caller graph for this function:

◆ setResult()

void bGame::setResult ( gameResult_t  rs)

Definition at line 191 of file game.cpp.

Referenced by playGameMove(), and revertGameMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResult() [2/2]

gameResult_t bGame::getResult ( ) const
inline

Definition at line 42 of file game.h.

Referenced by newGame(), setResult(), and WaitForSearchEnd().

+ Here is the caller graph for this function:

◆ setExpecting()

void bGame::setExpecting ( std::string const &  s)

Following command should return value as expected.

Definition at line 164 of file game.cpp.

Referenced by cmd_perft::execute(), and cmd_expect::execute().

+ Here is the caller graph for this function:

◆ isExpecting()

bool bGame::isExpecting ( std::string const &  s) const
Todo:
improve by redirecting App().bout

Definition at line 170 of file game.cpp.

◆ getExpecting()

std::string const & bGame::getExpecting ( ) const

Definition at line 178 of file game.cpp.

◆ evalEpdPosition()

bEpdResult bGame::evalEpdPosition ( bFen const &  fen,
bEpdOpCodes opcodes 
)

do actual epd position test

Definition at line 246 of file game.cpp.

Referenced by bEpd::parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evalPerftResult()

bEpdResult bGame::evalPerftResult ( bFen const &  fen,
bEpdOpCodes opcodes 
)

check perft result for different depths D[1-99] # perft test - nodes

Definition at line 304 of file game.cpp.

Referenced by bEpd::parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentPosition()

bBoard & bGame::getCurrentPosition ( )
Todo:
check why copy constructor is called, check if we should return

Definition at line 73 of file game.cpp.

Referenced by DoPerft(), DoSearch(), evalEpdPosition(), bel_debug::execute(), cmd_bd::execute(), cmd_usermove::execute(), cmd_eval::execute(), playGameMove(), revertGameMove(), setPlayerName(), and WaitForSearchEnd().

+ Here is the caller graph for this function:

◆ setLevel()

void bGame::setLevel ( bLevel const &  l)
inline

Definition at line 52 of file game.h.

Referenced by cmd_go::execute().

+ Here is the caller graph for this function:

◆ getLevel()

bLevel & bGame::getLevel ( )
inline

◆ getPositions()

positions_t & bGame::getPositions ( )
inline

Definition at line 54 of file game.h.

◆ setPlayerName()

void bGame::setPlayerName ( std::string const &  n)

Definition at line 62 of file game.cpp.

Referenced by cmd_UCI_Opponent::execute(), and cmd_name::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoSearch()

void bGame::DoSearch ( )

Start search thread and exit in case of batch mode, will wait until end of search.

in case of batch mode, do not start separate thread for searching

Todo:
allow for cancel search with ? / stop command

Definition at line 81 of file game.cpp.

Referenced by cmd_go::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AbortSearch()

void bGame::AbortSearch ( )

Definition at line 100 of file game.cpp.

Referenced by cmd_stop::execute(), and cmd_questionmark::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WaitForSearchEnd()

void bGame::WaitForSearchEnd ( )

Called in separate thread, sure to terminate normally.

Definition at line 108 of file game.cpp.

Referenced by DoSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoPerft()

int64_t bGame::DoPerft ( bSearchAlgorithm sa,
int const  d 
)

do perft search at depth

Definition at line 126 of file game.cpp.

Referenced by evalPerftResult(), cmd_perft::execute(), and bel_debug::run_bench().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvalForPlayer()

bScore bGame::EvalForPlayer ( bBoard const &  b)

Definition at line 151 of file game.cpp.

Referenced by bBoard::bBoard(), cmd_eval::execute(), playGameMove(), and bSearchAlgorithm::RetrieveBoardEvaluation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvalFinalScore()

gameResult_t bGame::EvalFinalScore ( bBoard const &  b)

Definition at line 156 of file game.cpp.

Referenced by engineInterface::sendResult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: