mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Remove castleRightsMask[] hack
Array castleRightsMask[] is not static because it can be different for different positions, so let it be a Position member data. This allows to remove tricky hacks to take in account that although it was defined static it could change. Theoretically now copying a position is a bit slower because we need to copy also an array of 64 integers, but because in split() we don't copy the position anymore, but just keep the pointer, the added burden is not mesurable even in MP case. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
3de0bc43a2
commit
b638f6b035
3 changed files with 1 additions and 7 deletions
|
@ -44,8 +44,6 @@ using std::string;
|
|||
//// Variables
|
||||
////
|
||||
|
||||
int Position::castleRightsMask[64];
|
||||
|
||||
Key Position::zobrist[2][8][64];
|
||||
Key Position::zobEp[64];
|
||||
Key Position::zobCastle[16];
|
||||
|
|
|
@ -328,12 +328,12 @@ private:
|
|||
Color sideToMove;
|
||||
int gamePly;
|
||||
Key history[MaxGameLength];
|
||||
int castleRightsMask[64];
|
||||
File initialKFile, initialKRFile, initialQRFile;
|
||||
StateInfo startState;
|
||||
StateInfo* st;
|
||||
|
||||
// Static variables
|
||||
static int castleRightsMask[64];
|
||||
static Key zobrist[2][8][64];
|
||||
static Key zobEp[64];
|
||||
static Key zobCastle[16];
|
||||
|
|
|
@ -441,10 +441,6 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
|
|||
{
|
||||
TM.set_active_threads(newActiveThreads);
|
||||
init_eval(TM.active_threads());
|
||||
// HACK: init_eval() destroys the static castleRightsMask[] array in the
|
||||
// Position class. The below line repairs the damage.
|
||||
Position p(pos.to_fen());
|
||||
assert(pos.is_ok());
|
||||
}
|
||||
|
||||
// Wake up sleeping threads
|
||||
|
|
Loading…
Add table
Reference in a new issue