Codex-generated pull request #139
No files matched your search
+669
-582
File diff suppressed because it is too large.
Load diff
+4
-2
@@ -65,11 +65,13 @@ public:
|
||||
void RemovePiece(int piece, int square, bool color);
|
||||
|
||||
void Promote(int square, int pieceType, int color, bool isCapture);
|
||||
bool MakeMove(Move move);
|
||||
bool MakeMove(Move move);
|
||||
bool IsLegal(Move move);
|
||||
|
||||
bool InPossibleZug();
|
||||
|
||||
Bitboard AttacksTo(int square, Bitboard occupancy);
|
||||
Bitboard AttacksTo(int square, Bitboard occupancy);
|
||||
bool IsSquareAttackedBy(bool attackerSide, int square, Bitboard occupancy);
|
||||
|
||||
bool IsSquareThreatened(bool side, int square);
|
||||
};
|
||||
+5
-6
@@ -206,10 +206,7 @@ static bool IsGameOver(Board &board, SEARCH::SearchContext* ctx) {
|
||||
int moveSeen = 0;
|
||||
|
||||
for (int i = 0; i < board.currentMoveIndex; i++) {
|
||||
Board copy = board;
|
||||
bool isLegal = copy.MakeMove(board.moveList[i]);
|
||||
|
||||
if (!isLegal) continue;
|
||||
if (!board.IsLegal(board.moveList[i])) continue;
|
||||
moveSeen++;
|
||||
}
|
||||
|
||||
@@ -227,12 +224,14 @@ static void PlayRandMoves(Board &board, SEARCH::SearchContext* ctx) {
|
||||
MOVEGEN::GenerateMoves<All>(board, true);
|
||||
|
||||
std::uniform_int_distribution<int> dist(0, board.currentMoveIndex - 1);
|
||||
bool isLegal = board.MakeMove(board.moveList[dist(rng)]);
|
||||
Move move = board.moveList[dist(rng)];
|
||||
|
||||
if (!isLegal) {
|
||||
if (!board.IsLegal(move)) {
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
board.MakeMove(move);
|
||||
ctx->positionHistory[board.positionIndex] = board.hashKey;
|
||||
MOVEGEN::GenerateMoves<All>(board, true);
|
||||
if (IsGameOver(board, ctx)) break;
|
||||
|
||||
+10
-8
@@ -358,9 +358,11 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
||||
continue;
|
||||
}
|
||||
|
||||
Move move = board.moveList[i];
|
||||
if (!board.IsLegal(move)) continue;
|
||||
|
||||
Board copy = board;
|
||||
int isLegal = copy.MakeMove(board.moveList[i]);
|
||||
if (!isLegal) continue;
|
||||
copy.MakeMove(move);
|
||||
|
||||
ctx->ss[ply].pieceType = board.GetPieceType(board.moveList[i].MoveFrom());
|
||||
ctx->ss[ply].moveTo = board.moveList[i].MoveTo();
|
||||
@@ -523,10 +525,10 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
if (!SEE(board, currMove, seeThreshold))
|
||||
continue;
|
||||
|
||||
Board copy = board;
|
||||
bool isLegal = copy.MakeMove(currMove);
|
||||
if (!board.IsLegal(currMove)) continue;
|
||||
|
||||
if (!isLegal) continue;
|
||||
Board copy = board;
|
||||
copy.MakeMove(currMove);
|
||||
|
||||
if (copy.positionIndex >= ctx->positionHistory.size()) {
|
||||
ctx->positionHistory.resize(copy.positionIndex + 100);
|
||||
@@ -610,10 +612,10 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
continue;
|
||||
}
|
||||
|
||||
Board copy = board;
|
||||
bool isLegal = copy.MakeMove(currMove);
|
||||
if (!board.IsLegal(currMove)) continue;
|
||||
|
||||
if (!isLegal) continue;
|
||||
Board copy = board;
|
||||
copy.MakeMove(currMove);
|
||||
|
||||
ctx->ss[ply].pieceType = board.GetPieceType(currMove.MoveFrom());
|
||||
ctx->ss[ply].moveTo = currMove.MoveTo();
|
||||
|
||||
Reference in new issue
Block a user