-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHash.h
More file actions
39 lines (33 loc) · 1.06 KB
/
Copy pathHash.h
File metadata and controls
39 lines (33 loc) · 1.06 KB
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
#include<cstdio>
#include<chrono>
#include<iostream>
#include<random>
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
uint64_t piece_values[2][6][64];
uint64_t castling_values[2][2];
uint64_t side_to_move_values[2];
uint64_t en_passant_values[17];
struct Zobrist {
Zobrist() {
std::uniform_int_distribution<uint64_t> distrib(1, uint64_t(1e18));
for(int side = 0; side < 2; ++side) {
for(int piece = 0; piece < 6; ++piece) {
for(int pos = 0; pos < 64; ++pos) {
piece_values[side][piece][pos] = distrib(rng);
}
}
}
for(int side = 0; side < 2; ++side) {
for(int i = 0; i < 2; ++i) {
castling_values[side][i] = distrib(rng);
}
}
for(int i = 0; i < 2; ++i) {
side_to_move_values[i] = distrib(rng);
}
for(int i = 0; i < 17; ++i) {
en_passant_values[i] = distrib(rng);
}
}
};
Zobrist zobrist;