#include "misc.hpp" #include "board/board.hpp" #include "moves.hpp" #include #include #include #include /* * Return engine name with version number */ std::string_view engine_info() { return "Mono 1\n"; } /* * Returns total possible branches with depth X */ uint64_t MoveGenTest(uint32_t depth, Game *g) { if (depth == 0) { return 1; } uint64_t positionCount = 0; std::vector moves = GetLegalMoves(g, ALL); // 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 positionCount; } uint64_t MoveGenTestDivide(uint32_t depth, Game *g) { if (depth == 0) { return 1; } uint64_t total = 0; std::vector moves = GetLegalMoves(g, ALL); for (uint16_t move : moves) { uint8_t from = getFromValueFromMove(move); uint8_t to = getToValueFromMove(move); Position fromPos = IndexToPosition(from); Position toPos = IndexToPosition(to); Undo undo = MakeMove(move, g); uint64_t count = MoveGenTest(depth - 1, g); UndoMove(undo, g); char fromFile = static_cast('a' + fromPos.file); char toFile = static_cast('a' + toPos.file); std::cout << fromFile << (fromPos.rank + 1) << toFile << (toPos.rank + 1); PieceType promo = getPromotionTypeFromMove(move); if (promo == QUEEN) std::cout << 'q'; else if (promo == ROOK) std::cout << 'r'; else if (promo == KNIGHT) std::cout << 'n'; else if (promo == BISHOP) std::cout << 'b'; std::cout << ": " << count << "\n"; total += count; } std::cout << "\nTotal: " << total << "\n"; return total; }