added global peft

This commit is contained in:
Karma Riuk 2025-02-04 21:51:58 +01:00
parent 151a50fba9
commit df20060075
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,5 @@
#include "stickfosh.hpp"
#include "board.hpp"
#include "move.hpp"
@ -65,7 +67,13 @@ int move_generation_test(Board& b, int depth, int max_depth) {
return num_pos;
}
void perft() {
for (auto& [key, value] : pos2expected)
perft(key);
}
void perft(std::string pos) {
std::cout << pos << std::endl;
std::map<int, int> expected = pos2expected[pos];
Board b = Board::setup_fen_position(pos);
@ -85,7 +93,9 @@ void perft(std::string pos) {
std::cout << cross << " (expected " << expected_n_moves << ") ";
std::cout << "positions Time: " << elapsed << " milliseconds"
<< std::endl;
if (moves != expected_n_moves)
if (moves != expected_n_moves) {
std::cout << std::endl << res.str();
exit(1);
}
}
}

View File

@ -3,3 +3,4 @@
#include <string>
void perft(std::string pos);
void perft();