diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-15 20:47:22 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-15 20:47:22 +0200 |
| commit | 242b2022ae234e252fe410b276e6d7c971147980 (patch) | |
| tree | 6352cc5b7247d1d7ca688b15ec71122696682f94 /src/misc.cpp | |
| parent | 831411d0a4fd7f67d6a27a6275dec0c6513a23f2 (diff) | |
renaming things
Diffstat (limited to 'src/misc.cpp')
| -rw-r--r-- | src/misc.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index 79cf74f..6737777 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -2,19 +2,32 @@ #include "moves.hpp" #include <cstdint> #include <string_view> +#include <vector> +/* + * Return engine name with version number + */ std::string_view engine_info() { return "Mono 1\n"; } -uint64_t MoveGenTest(int depth, Game *g) { - uint64_t num = 0; - if (depth <= 0) { +/* + * Returns total possible branches with depth X + */ +uint64_t MoveGenTest(uint32_t depth, Game *g) { + 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); + + uint64_t positionCount = 0; + + std::vector<uint16_t> moves = GetLegalMoves(g); + + // for each possible move create new branch + for (uint16_t move : moves) { + Undo undo = MakeMove(move, g); + + positionCount += MoveGenTest(depth - 1, g); + + UndoMove(undo, g); } - return num; + return positionCount; } |
