blob: e7f2d87efa4dd6636846f6c04e8ec4f923695477 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include "board/board.hpp"
#include "hash.hpp"
#include "misc.hpp"
#include "moves.hpp"
#include "uci.hpp"
static void hashCmd(int argc, char *argv[]) {
if (argc < 3) {
std::cout << "Usage: ./mono hash <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);
}
auto start = std::chrono::steady_clock::now();
uint64_t hash = GenerateHashFromScratch(&game);
auto end = std::chrono::steady_clock::now();
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
std::ostringstream oss;
oss << "{\"ms\": " << ms << ", \"hash\": " << hash << "}";
std::cout << oss.str() << "\n";
}
int main(int argc, char *argv[]) {
InitHashing();
initMagicBitboards();
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;
}
|