From fa53cfa52d92d9306cd6f8bd227147ab0d4c2611 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 20 Aug 2026 10:41:26 +0200 Subject: refactor(hash): refactoring hash logic to be better --- src/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 98ff360..27b428d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,10 +8,10 @@ #include "board/board.hpp" #include "board/fen.hpp" +#include "hash.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") { @@ -49,9 +49,9 @@ 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 [moves...]\n"; +static void hashCmd(int argc, char *argv[]) { + if (argc < 3) { + std::cout << "Usage: ./mono hash [moves...]\n"; exit(1); } @@ -65,7 +65,7 @@ static void zobristCmd(int argc, char *argv[]) { auto start = std::chrono::steady_clock::now(); - uint64_t hash = GenerateZobristKey(&game); + uint64_t hash = GenerateHashFromScratch(&game); auto end = std::chrono::steady_clock::now(); auto ms = std::chrono::duration_cast(end - start) .count(); @@ -76,7 +76,7 @@ static void zobristCmd(int argc, char *argv[]) { } int main(int argc, char *argv[]) { - InitZobrist(); + InitHashing(); initMagicBitboards(); if (argc >= 2 && std::string(argv[1]) == "perft") { @@ -84,11 +84,15 @@ int main(int argc, char *argv[]) { return 0; } - if (argc >= 2 && std::string(argv[1]) == "zobrist") { - zobristCmd(argc, argv); + if (argc >= 2 && std::string(argv[1]) == "hash") { + hashCmd(argc, argv); return 0; } + if (argc != 1) { + std::cout << "Usage: ./mono \n"; + return 0; + } std::cerr << engine_info(); Uci(); return 0; -- cgit v1.2.3