Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
belofte Namespace Reference

Allow index mapper for char values of piece into int in 1-12 range to reduce space and easy initialisation. More...

Typedefs

typedef std::vector< std::string > stringList
 

Functions

stringList const stringSplit (std::string src, std::string const &delim)
 Split delimited long string into a vector.
 
std::pair< std::string, std::string > decompose (std::string const &src, std::string const &delim)
 Split delimited long string into a pair based on delimiter e.g.
 
std::string to_string (int16_t value)
 std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function
 
std::string to_string (int32_t value)
 
std::string to_string (int64_t value)
 
std::string alltrim (std::string s, std::string const &delim=" ")
 trim left and right spaces or delim from string
 
bool is_number (std::string const &s)
 
int getRandomInt (int const nCeil)
 return random in between 0 and nCeil - 1
 
int getRandomRange (int const nStart, int const nMax)
 
std::string getRCname (std::string const &basename)
 convert executable name into name.rc, possibly dropping .exe suffix
 
int positionParamIndex (stringList const &param, std::string const &find)
 find position in which param has been found
 
int positionParamValue (stringList const &param, std::string const &find, unsigned long const nOffSet=0)
 
std::string currentDate ()
 
std::string prettyTime (long const t)
 

Variables

bWhiteKing const * cWhiteKingClass = nullptr
 
bBlackKing const * cBlackKingClass = nullptr
 
static piece_t bPieceIndex [128] = {}
 
static cpiece_t bPieceMapper [tPiece::P_SIZE] = {}
 
static bPiecepieceinstances [tPiece::P_SIZE]
 
static boardbitmap_t kingmoves [64] = {}
 
static boardbitmap_t knightmoves [64] = {}
 
static case_t kingarray [64][9] = {}
 
static case_t knightarray [64][9] = {}
 

Detailed Description

Allow index mapper for char values of piece into int in 1-12 range to reduce space and easy initialisation.

we declare a separate namespace just for code purity below declarations are globals, not static

Typedef Documentation

◆ stringList

typedef std::vector<std::string> belofte::stringList

Definition at line 46 of file util.h.

Function Documentation

◆ stringSplit()

belofte::stringList const belofte::stringSplit ( std::string src,
std::string const & delim )

Split delimited long string into a vector.

Definition at line 133 of file util.cpp.

Referenced by bBasicBoard::bBasicBoard(), cmd_bench::execute(), cmd_epd::execute(), cmd_go::execute(), cmd_level::execute(), cmd_option::execute(), cmd_perft::execute(), cmd_setoption::execute(), bEpd::parseSTSPosition(), bGame::playGameMoveSeries(), engineInterface::sendHelp(), bEpd::setPos(), and bEpd::translateEpdResult().

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

◆ decompose()

std::pair< std::string, std::string > belofte::decompose ( std::string const & src,
std::string const & delim )

Split delimited long string into a pair based on delimiter e.g.

parameter1=x y z, "=" => parameter1, x y z 1) the chapter, " " => 1), the chapter

Definition at line 152 of file util.cpp.

Referenced by bEpd::parseSTSPosition(), and bEpd::setPos().

+ Here is the caller graph for this function:

◆ to_string() [1/3]

◆ to_string() [2/3]

std::string belofte::to_string ( int32_t value)

Definition at line 178 of file util.cpp.

◆ to_string() [3/3]

std::string belofte::to_string ( int64_t value)

Definition at line 185 of file util.cpp.

◆ alltrim()

std::string belofte::alltrim ( std::string s,
std::string const & delim = " " )

trim left and right spaces or delim from string

Definition at line 195 of file util.cpp.

Referenced by bBasicBoard::bBasicBoard(), cmd_setoption::execute(), bEpd::parsePerftPosition(), bEpd::parseSTSPosition(), bEpd::setPos(), and stringSplit().

+ Here is the caller graph for this function:

◆ is_number()

bool belofte::is_number ( std::string const & s)

Definition at line 205 of file util.cpp.

Referenced by bEpd::setPos().

+ Here is the caller graph for this function:

◆ getRandomInt()

int belofte::getRandomInt ( int const nCeil)

return random in between 0 and nCeil - 1

Definition at line 214 of file util.cpp.

Referenced by SearchRandom::CalcBestMove().

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

◆ getRandomRange()

int belofte::getRandomRange ( int const nStart,
int const nMax )

Definition at line 227 of file util.cpp.

Referenced by PosEvalStaticBoard::getEndgameEvaluation(), PosEvalPiecesOnly::getEvaluation(), PosEvalStaticBoard::getMatingEvaluation(), PosEvalStaticBoard::getPawnEndingEvaluation(), and PosEvalStaticBoard::getRelativeBoardEval().

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

◆ getRCname()

std::string belofte::getRCname ( std::string const & basename)

convert executable name into name.rc, possibly dropping .exe suffix

Definition at line 243 of file util.cpp.

◆ positionParamIndex()

int belofte::positionParamIndex ( stringList const & param,
std::string const & find )

find position in which param has been found

Parameters
paramvector of strings
findstring to find
Returns
-1 in case of nothing found

Definition at line 259 of file util.cpp.

Referenced by cmd_go::execute().

+ Here is the caller graph for this function:

◆ positionParamValue()

int belofte::positionParamValue ( stringList const & param,
std::string const & find,
unsigned long const nOffSet = 0 )

Definition at line 268 of file util.cpp.

Referenced by cmd_go::execute().

+ Here is the caller graph for this function:

◆ currentDate()

std::string belofte::currentDate ( )

Definition at line 279 of file util.cpp.

Referenced by bGame::newGame().

+ Here is the caller graph for this function:

◆ prettyTime()

std::string belofte::prettyTime ( long const t)

Definition at line 289 of file util.cpp.

Referenced by TimedExecution::getDuration(), bLevel::operator std::string(), and bel_debug::run_bench().

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

Variable Documentation

◆ cWhiteKingClass

◆ cBlackKingClass

◆ bPieceIndex

piece_t belofte::bPieceIndex[128] = {}
static

Definition at line 15 of file piece.cpp.

Referenced by bPiece_ctor(), and bPiece::getPiece().

◆ bPieceMapper

cpiece_t belofte::bPieceMapper[tPiece::P_SIZE] = {}
static

Definition at line 16 of file piece.cpp.

Referenced by bPiece_ctor(), and bPiece::getPieceChar().

◆ pieceinstances

bPiece* belofte::pieceinstances[tPiece::P_SIZE]
static

Definition at line 17 of file piece.cpp.

Referenced by bPiece_ctor(), bPiece_dtor(), and bPiece::getPieceClass().

◆ kingmoves

boardbitmap_t belofte::kingmoves[64] = {}
static

Definition at line 18 of file piece.cpp.

Referenced by bPiece_ctor(), bBlackPiece::isAttacked(), and bWhitePiece::isAttacked().

◆ knightmoves

boardbitmap_t belofte::knightmoves[64] = {}
static

Definition at line 19 of file piece.cpp.

Referenced by bPiece_ctor().

◆ kingarray

◆ knightarray