//====================================== Eyes ================================= char is_eyeish(Position *pos, Point pt) // test if pt is inside a single-color diamond and return the diamond color or 0 // this could be an eye, but also a false one { Color eyecolor=EMPTY, other=EMPTY; int k; Point n; FORALL_NEIGHBORS(pos, pt, k, n) { Color c = point_color(pos,n); if(c == OUT) continue; // ignore OUT of board neighbours if(c == EMPTY) return 0; if(eyecolor == EMPTY) { eyecolor = c; other = color_other(c); } else if (c == other) return 0; }
int uct_simulate(UCTNode * self, Board * board, Color color) { int result; Pos move; UCTNode * ptr; if(!self->child && self->visits < UCT_MIN_VISITS) result = uct_play_random_game(board, color); else { if(!self->child) create_children(self, board, color); ptr = uct_select(self, board, color); result = 1 - uct_simulate(ptr, board, color_other(color)); } self->visits ++; self->wins += 1 - result; return result; }