diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index ade22c9..1fa0701 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,12 +7,14 @@ #include <string> #include "board/board.hpp" +#include "board/fen.hpp" #include "misc.hpp" +#include "moves.hpp" #include "uci.hpp" #include "zobrist.hpp" static void perft(int argc, char *argv[]) { - if (argc != 4 || std::string(argv[1]) != "perft") { + if (argc < 4 || std::string(argv[1]) != "perft") { std::cout << "Usage: ./mono\n"; std::cout << " ./mono perft <non-negative depth> <fen>\n"; exit(1); @@ -42,14 +44,37 @@ static void perft(int argc, char *argv[]) { std::cout << oss.str() << "\n"; } +static void zobristCmd(int argc, char *argv[]) { + if (argc < 3 || std::string(argv[1]) != "zobrist") { + std::cout << "Usage: ./mono zobrist <fen> [moves...]\n"; + exit(1); + } + + std::string fen = argv[2]; + Game game = initBoard(fen, nullptr); + + for (int i = 3; i < argc; ++i) { + uint16_t move = UciToMove(argv[i]); + MakeMove(move, &game); + } + + uint64_t hash = GenerateZobristKey(&game); + std::cout << hash << "\n"; +} + int main(int argc, char *argv[]) { InitZobrist(); - if (argc == 4) { + if (argc >= 2 && std::string(argv[1]) == "perft") { perft(argc, argv); return 0; } + if (argc >= 2 && std::string(argv[1]) == "zobrist") { + zobristCmd(argc, argv); + return 0; + } + std::cout << engine_info(); Uci(); return 0; |
