forked from ryanbhayward/miowy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.h
executable file
·42 lines (34 loc) · 899 Bytes
/
node.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
#ifndef NODE_H
#define NODE_H
#include "board.h"
#include <cstddef>
static const int UNKNOWN = 2;
static const int PROVEN_WIN = 1;
static const int PROVEN_LOSS = 0;
static const float UCB_EXPLORE = 1.0;
static const int EXPAND_THRESHOLD = 2;
struct Stats {
int w; // number of wins for player to move from this state
int n; // number of playouts from this state
Stats() : w(0), n(0) { }
} ;
struct Child ; // forward ref
struct Node {
Stats stat;
int proofStatus;
Child* children;
int numChildren;
Node() : proofStatus(UNKNOWN), children(NULL), numChildren(0) { } // constructor
~Node() ; // destructor
void expand (Board&, int s) ;
int bestChildNdx() ;
int bestMove() ;
bool isLeaf() {return children==NULL; }
float ucb_eval(Node& child) ;
int uct_playout(Board&, int s, bool useMiai) ;
} ;
struct Child {
Node node;
int lcn;
} ;
#endif