-
Notifications
You must be signed in to change notification settings - Fork 16
/
TTable.h
49 lines (38 loc) · 782 Bytes
/
TTable.h
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
#ifndef TTABLE_H_INCLUDED
#define TTABLE_H_INCLUDED
#include <vector>
#include "UCTNode.h"
#include "SMP.h"
class TTEntry {
public:
TTEntry()
: m_hash(0) {
};
uint64 m_hash;
// XXX: need RAVE data here?
double m_blackwins;
int m_visits;
double m_eval_sum;
int m_eval_count;
};
class TTable {
public:
/*
return the global TT
*/
static TTable* get_TT(void);
/*
update corresponding entry
*/
void update(uint64 hash, const float komi, const UCTNode * node);
/*
sync given node with TT
*/
void sync(uint64 hash, const float komi, UCTNode * node);
private:
TTable(int size = 500000);
SMP::Mutex m_mutex;
std::vector<TTEntry> m_buckets;
float m_komi;
};
#endif