aboutsummaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-08-15 20:47:22 +0200
committerAdam <adammegarules1@gmail.com>2026-08-15 20:47:22 +0200
commit242b2022ae234e252fe410b276e6d7c971147980 (patch)
tree6352cc5b7247d1d7ca688b15ec71122696682f94 /src/misc.cpp
parent831411d0a4fd7f67d6a27a6275dec0c6513a23f2 (diff)
renaming things
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp31
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;
}