From 5b45fc32c07ad61fac26d86a8f9c15e718cca865 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Fri, 7 Feb 2025 16:18:11 +0100 Subject: [PATCH] annoying --- cpp/src/main.cpp | 11 ++++++++--- cpp/src/model/perft/perft.cpp | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/cpp/src/main.cpp b/cpp/src/main.cpp index ab1e7fd..39d3c2a 100644 --- a/cpp/src/main.cpp +++ b/cpp/src/main.cpp @@ -15,8 +15,13 @@ int main(int argc, char* argv[]) { // std::string pos = // "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 4 3 // "; - std::string pos = - "r3k2r/p1ppqpb1/Bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPB1PPP/R3K2R b KQkq - 0 3"; + + // pos for ai timing< + // std::string pos = + // "r3k2r/p1ppqpb1/Bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPB1PPP/R3K2R b KQkq - 0 + // 3"; + std::string pos = "r3k2r/p1p1qpb1/bn1ppnp1/3PN3/1p2P3/P1N2Q1p/1PPBBPPP/" + "1R2K2R b Kkq - 0 4"; Board b = Board::setup_fen_position(pos); @@ -33,6 +38,6 @@ int main(int argc, char* argv[]) { // controller.start(); - perft(); + perft(pos); return 0; } diff --git a/cpp/src/model/perft/perft.cpp b/cpp/src/model/perft/perft.cpp index d9fb38e..8f27734 100644 --- a/cpp/src/model/perft/perft.cpp +++ b/cpp/src/model/perft/perft.cpp @@ -107,6 +107,28 @@ static std::map> pos2expected{ {4, 4085603}, // }, }, + // -- Position 7 after a1b1 + { + "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/1R2K2R b Kkq - 5 3", + { + {3, 83348}, // + }, + }, + // -- Position 7 after a1b1 d7d6 + { + "r3k2r/p1p1qpb1/bn1ppnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/1R2K2R w Kkq - 0 4", + { + {2, 1919}, // + }, + }, + // -- Position 7 after a1b1 d7d6 a2a3 + { + "r3k2r/p1p1qpb1/bn1ppnp1/3PN3/1p2P3/P1N2Q1p/1PPBBPPP/1R2K2R b Kkq - 0 " + "4", + { + {1, 45}, // + }, + }, }; static std::stringstream res; @@ -119,8 +141,7 @@ int move_generation_test( res.clear(); } - if (b.is_checkmate_for(b.white_to_play ? White : Black) - || b.is_stalemate_for(b.white_to_play ? White : Black)) + if (b.is_terminal()) return 1; if (depth == 0) return 1; @@ -150,7 +171,7 @@ int move_generation_test( // } else { // Regular sequential execution for (const Move& move : moves) { - std::cout << "Looking at " << move << std::endl; + // std::cout << "Looking at " << move << std::endl; Board tmp_board = b.make_move(move); int n = move_generation_test(tmp_board, depth - 1, max_depth, pool); if (depth == max_depth)