Fifty move #31
No files matched your search
@@ -9,6 +9,10 @@
|
|||||||
void Board::Reset() {
|
void Board::Reset() {
|
||||||
castlingRights = 0;
|
castlingRights = 0;
|
||||||
enPassantTarget = noEPTarget;
|
enPassantTarget = noEPTarget;
|
||||||
|
|
||||||
|
halfMoves = 0;
|
||||||
|
fullMoves = 1;
|
||||||
|
|
||||||
sideToMove = White;
|
sideToMove = White;
|
||||||
occupied = 0ULL;
|
occupied = 0ULL;
|
||||||
|
|
||||||
@@ -65,6 +69,12 @@ void Board::SetByFen(std::string_view fen) {
|
|||||||
|
|
||||||
if (tokens[3] != "-") enPassantTarget = UTILS::parseSquare(tokens[3]);
|
if (tokens[3] != "-") enPassantTarget = UTILS::parseSquare(tokens[3]);
|
||||||
|
|
||||||
|
// full and half move
|
||||||
|
if (tokens.size() > 4) {
|
||||||
|
halfMoves = std::stoi(tokens[4]);
|
||||||
|
fullMoves = std::stoi(tokens[5]);
|
||||||
|
}
|
||||||
|
|
||||||
occupied = colors[White] | colors[Black];
|
occupied = colors[White] | colors[Black];
|
||||||
hashKey = UTILS::GetHashKey(*this);
|
hashKey = UTILS::GetHashKey(*this);
|
||||||
MOVEGEN::GenThreatMaps(*this);
|
MOVEGEN::GenThreatMaps(*this);
|
||||||
@@ -340,6 +350,13 @@ bool Board::MakeMove(Move move) {
|
|||||||
if (InCheck()) return false;
|
if (InCheck()) return false;
|
||||||
sideToMove = !sideToMove;
|
sideToMove = !sideToMove;
|
||||||
|
|
||||||
|
if (attackerColor == Black) fullMoves++;
|
||||||
|
if (attackerPiece == Pawn || move.IsCapture()) {
|
||||||
|
halfMoves = 0;
|
||||||
|
} else {
|
||||||
|
halfMoves++;
|
||||||
|
}
|
||||||
|
|
||||||
positionIndex++;
|
positionIndex++;
|
||||||
positionHistory[positionIndex] = hashKey;
|
positionHistory[positionIndex] = hashKey;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ public:
|
|||||||
uint8_t castlingRights = 0;
|
uint8_t castlingRights = 0;
|
||||||
int enPassantTarget = noEPTarget;
|
int enPassantTarget = noEPTarget;
|
||||||
|
|
||||||
|
int halfMoves = 0;
|
||||||
|
int fullMoves = 1;
|
||||||
|
|
||||||
U64 hashKey = 0ULL;
|
U64 hashKey = 0ULL;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|||||||
+5
-1
@@ -98,6 +98,10 @@ static bool IsThreefold(Board &board) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsFifty(Board &board) {
|
||||||
|
return (board.halfMoves >= 100);
|
||||||
|
}
|
||||||
|
|
||||||
static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply) {
|
static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int ply) {
|
||||||
int reduction = 0;
|
int reduction = 0;
|
||||||
|
|
||||||
@@ -170,7 +174,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pvLine.SetLength(ply);
|
pvLine.SetLength(ply);
|
||||||
if (ply && IsThreefold(board)) return 0;
|
if (ply && (IsThreefold(board) || IsFifty(board))) return 0;
|
||||||
|
|
||||||
|
|
||||||
// if NOT PV node then we try to hit the TTable
|
// if NOT PV node then we try to hit the TTable
|
||||||
|
|||||||
Reference in new issue
Block a user