bugfix in move ordering + changed default search depth to 6

This commit is contained in:
rektdie committed 2024-06-22 14:41:56 +02:00
1 parent 8c4a157797
commit 6f8272b51b
3 files changed
+9 -9

No files matched your search

+6 -5
View File
@@ -135,13 +135,14 @@ static int NegaMax(Board board, int depth, int alpha, int beta, bool isRoot) {
board.MakeMove(board.moveList[i]); board.MakeMove(board.moveList[i]);
ply++; ply++;
int score = -NegaMax(board, depth - 1, -beta, -alpha, false); int score = -NegaMax(board, depth - 1, -beta, -alpha, false);
board = copy; board = copy; ply--;
ply--;
if (score >= beta) { if (score >= beta) {
// store killer moves if (board.moveList[i].IsCapture()) {
killerMoves[1][ply] = killerMoves[0][ply]; // store killer moves
killerMoves[0][ply] = board.moveList[i]; killerMoves[1][ply] = killerMoves[0][ply];
killerMoves[0][ply] = board.moveList[i];
}
return beta; return beta;
} }
+1 -1
View File
@@ -6,7 +6,7 @@ using U64 = uint64_t;
constexpr char StartingFen[] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; constexpr char StartingFen[] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
constexpr char KiwiPeteFen[] = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -"; constexpr char KiwiPeteFen[] = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -";
constexpr char KillerFen[] = "rnbqkb1r/pp1p1pPp/8/2p1pP2/1P1P4/3P3P/P1P1P3/RNBQKBNR w KQkq e6 0 1"; constexpr char KillerFen[] = "6k1/3q1pp1/pp5p/1r5n/8/1P3PP1/PQ4BP/2R3K1 w - - 0 1";
enum COLOR { enum COLOR {
White, White,
+2 -3
View File
@@ -26,8 +26,7 @@ Move ParseMove(Board &board, const char* moveString) {
it = std::find(squareCoords.begin(), squareCoords.end(), toString); it = std::find(squareCoords.begin(), squareCoords.end(), toString);
int to = std::distance(squareCoords.begin(), it); int to = std::distance(squareCoords.begin(), it);
std::string promotionString = "";
std::string promotionString = "";
// Finding the move from available moves // Finding the move from available moves
for (Move move : board.moveList) { for (Move move : board.moveList) {
@@ -148,7 +147,7 @@ void ParseGo(Board &board, const char* command) {
depth = atoi(command); depth = atoi(command);
} else { // other command parameters } else { // other command parameters
depth = 5; depth = 6;
} }
// search position // search position