#pragma once #ifndef MCTS_H #define MCTS_H #include #include #include #include #include #include #include "MT.h" #define C 0.31 /* 共立出版 (2012)松原仁 編, 美添一樹 ? 山下宏 著 「コンピュータ囲碁 モンテカルロ法の理論と実践」より */ #define PLAYOUT_TIMES 1500/*500*//*1000*//*1500*//*2000*/ #define UCBMAX 1000 #define THRESHOLD 20 #define KOMI 7.5 #define SPACE 0 #define BLACK 1 #define WHITE -1 #define SENTINEL 3 typedef struct uct_node { int pos; int playout_sum; int win_black; int win_white; int child_num; struct uct_node *next; struct uct_node *parent; struct uct_node *child[1]; } uct_node; /*__declspec(dllexport) int mcts(int color, int size, int *pos_array, int ko_pos);*/ __declspec(dllexport) int mcts(int* x, int* y, int* pos_array, int color, int size, int ko_x, int ko_y, int playout, int komi); uct_node* make_uct(uct_node** que, int size); int expand_node(uct_node** que, uct_node* parent, int size, int *pos_array, int ko_pos); int search_uct(uct_node** que, uct_node *node, int color, int size, int *posl); int verify_legal(int pos, int color, int *posl,int *ko_pos, int update); int verify_neighbor(int pos, int color, char *check, int *posl, short *n); int verify_liberty(int pos, int color, char *check, int *posl); int playout(int color, int size, int *posl, int ko); #endif