-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcHash.h
More file actions
31 lines (26 loc) · 746 Bytes
/
cHash.h
File metadata and controls
31 lines (26 loc) · 746 Bytes
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
#ifndef HASH_H_
#define HASH_H_
#include <random>
#include <unordered_map>
#include <iostream>
#include <semaphore.h>
#include "types.h"
extern int rank;
class cHash
{
private:
unsigned long long mPieceHashes[832]; //13 pieces * 64 board positions
unsigned long long mBoardHash;
unsigned long long mHashTableSize;
std::unordered_map<unsigned long long, hashState> mHashTable;
public:
cHash(int board[][8]);
void fInitSemaphore();
unsigned long long fGetHash();
void fSetBoard(int board[][8]);
void fUpdateHash(gameMove *m, unsigned long long &hash);
hashState* fFindState(unsigned long long &hash);
void fAddState(hashState &s);
unsigned long long fBoardToHash(int board[][8]);
};
#endif