diff options
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; } |
