From 63f380a48ab21f39962b60837fa487e9f978be95 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 31 Jul 2026 15:14:12 +0200 Subject: adding perft --- src/misc.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/misc.cpp') diff --git a/src/misc.cpp b/src/misc.cpp index 8527fdc..db9240c 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -1,4 +1,6 @@ #include "misc.hpp" +#include "moves.hpp" +#include #include std::string version = "0"; @@ -6,3 +8,17 @@ std::string version = "0"; std::string engine_version() { return "Mono " + version; }; std::string engine_info() { return engine_version() + " by Adam " + "\n"; } + +uint64_t MoveGenTest(int depth, Game *g) { + uint64_t num = 0; + if (depth <= 0) { + return 1; + } + auto moves = GetLegalMoves(g); + for (auto move : moves) { + UndoMove undo = MakeMove(move, g); + num += MoveGenTest(depth - 1, g); + UnMakeMove(undo, g); + } + return num; +} -- cgit v1.2.3