Revert "encapsulated positionHistory | bench 1857933"
This reverts commit 2e8c23103f.
This commit is contained in:
1 parent
ce02841a5c
commit
3275cee01e
6 files changed
+37
-34
No files matched your search
@@ -393,6 +393,7 @@ bool Board::MakeMove(Move move) {
|
||||
}
|
||||
|
||||
positionIndex++;
|
||||
positionHistory[positionIndex] = hashKey;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -443,3 +444,28 @@ void Board::ResetAccPair() {
|
||||
blackPieces.PopBit(square);
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsThreefold(Board& board) {
|
||||
for (int i = 0; i < board.positionIndex; i++) {
|
||||
if (positionHistory[i] == board.hashKey) {
|
||||
// repetition found
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// no repetition
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsFifty(Board& board) {
|
||||
return (board.halfMoves >= 100);
|
||||
}
|
||||
|
||||
static bool IsInsuffMat(Board& board) {
|
||||
return (board.occupied.PopCount() <= 3
|
||||
&& !(board.pieces[Pawn] | board.pieces[Queen] | board.pieces[Rook]));
|
||||
}
|
||||
|
||||
bool Board::IsDraw() {
|
||||
return IsFifty(*this) || IsInsuffMat(*this) || IsThreefold(*this);
|
||||
}
|
||||
Reference in new issue
Block a user