diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-20 10:41:26 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-20 10:41:26 +0200 |
| commit | fa53cfa52d92d9306cd6f8bd227147ab0d4c2611 (patch) | |
| tree | 9e12a2ffeca15804acb1a2bf53f8b721d1b997c5 /src/main.cpp | |
| parent | d10a05eb92423777c6ff32edd14a1bea32214801 (diff) | |
refactor(hash): refactoring hash logic to be better
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
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 <fen> [moves...]\n"; +static void hashCmd(int argc, char *argv[]) { + if (argc < 3) { + std::cout << "Usage: ./mono hash <fen> [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<std::chrono::milliseconds>(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; |
