Skip to content

Commit

Permalink
Merge pull request #113 from kobanium/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
kobanium authored Jun 9, 2018
2 parents c00b80d + 55b2b54 commit 7fb2f10
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 101 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.o
*.o
ray
8 changes: 4 additions & 4 deletions src/GoBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int first_move_candidates; // 初手の候補手の個数

double komi[S_WHITE + 1]; // コミの値
double dynamic_komi[S_WHITE + 1]; // ダイナミックコミの値
double default_komi = KOMI; // デフォルトのコミの値
static double default_komi = KOMI; // デフォルトのコミの値

int board_pos_id[BOARD_MAX]; // 盤上の位置の識別番号

Expand All @@ -46,12 +46,12 @@ int move_dis[PURE_BOARD_SIZE][PURE_BOARD_SIZE]; // 着手距離
int onboard_pos[PURE_BOARD_MAX]; // 実際の盤上の位置との対応
int first_move_candidate[PURE_BOARD_MAX]; // 初手の候補手

int corner[4];
int corner_neighbor[4][2];
static int corner[4];
static int corner_neighbor[4][2];

int cross[4];

bool check_superko = false; // 超劫の確認の設定
static bool check_superko = false; // 超劫の確認の設定

///////////////
// 関数宣言 //
Expand Down
6 changes: 2 additions & 4 deletions src/Ladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ IsLadderCaptured( const int depth, search_game_info_t *game, const int ren_xy, c
const char *board = game->board;
const string_t *string = game->string;
const int str = game->string_id[ren_xy];
int escape_color, capture_color;
int escape_xy, capture_xy;
int neighbor;
int escape_color, capture_color, escape_xy, capture_xy, neighbor;
bool result;

if (depth >= 100) {
Expand Down Expand Up @@ -172,7 +170,7 @@ CheckLadderExtension( game_info_t *game, int color, int pos )
return false;
}

int id = string_id[pos];
const int id = string_id[pos];

int ladder = string[id].lib[0];

Expand Down
16 changes: 8 additions & 8 deletions src/Rating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ using namespace std;
////////////////

// 戦術的特徴のγ値
float po_tactical_features[TACTICAL_FEATURE_MAX];
static float po_tactical_features[TACTICAL_FEATURE_MAX];
// 3x3パターンのγ値
float po_pat3[PAT3_MAX];
static float po_pat3[PAT3_MAX];
// MD2のパターンのγ値
float po_md2[MD2_MAX];
static float po_md2[MD2_MAX];
// 3x3とMD2のパターンのγ値の積
float po_pattern[MD2_MAX];
static float po_pattern[MD2_MAX];
// 学習した着手距離の特徴
float po_neighbor_orig[PREVIOUS_DISTANCE_MAX];
static float po_neighbor_orig[PREVIOUS_DISTANCE_MAX];
// 補正した着手距離の特徴
float po_previous_distance[PREVIOUS_DISTANCE_MAX];
static float po_previous_distance[PREVIOUS_DISTANCE_MAX];
// 戦術的特徴1
float po_tactical_set1[PO_TACTICALS_MAX1];
static float po_tactical_set1[PO_TACTICALS_MAX1];
// 戦術的特徴2
float po_tactical_set2[PO_TACTICALS_MAX2];
static float po_tactical_set2[PO_TACTICALS_MAX2];
// パラメータのファイルを格納しているディレクトリのパス
char po_params_path[1024];

Expand Down
10 changes: 0 additions & 10 deletions src/Rating.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,8 @@ const double PO_BIAS = 1.66542;
// 変数 //
////////////

extern float po_tactical_features[TACTICAL_FEATURE_MAX];
extern float po_neighbor8[PREVIOUS_DISTANCE_MAX];
extern float po_pat3[PAT3_MAX];
extern float po_md2[MD2_MAX];
extern float po_pattern[MD2_MAX];
extern float po_tactical_set1[PO_TACTICALS_MAX1];
extern float po_tactical_set2[PO_TACTICALS_MAX2];

extern char po_params_path[1024];

// ビットマスク
extern unsigned int tactical_features_mask[F_MASK_MAX];

////////////
// 関数 //
Expand Down
23 changes: 11 additions & 12 deletions src/Seki.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,26 @@ using namespace std;
void
CheckSeki( const game_info_t *game, bool seki[] )
{
int i, j, k, pos, id;
const char *board = game->board;
const int *string_id = game->string_id;
const string_t *string = game->string;
bool seki_candidate[BOARD_MAX] = {false};
int lib1, lib2;
int id, lib1, lib2;
int lib1_id[4], lib2_id[4], lib1_ids, lib2_ids;
int neighbor1_lib, neighbor2_lib;
int neighbor4[4];
bool seki_candidate[BOARD_MAX] = {false};
bool already_checked;

// 双方が自己アタリになっている座標を抽出
for (i = 0; i < pure_board_max; i++) {
pos = onboard_pos[i];
for (int i = 0; i < pure_board_max; i++) {
const int pos = onboard_pos[i];
if (IsSelfAtari(game, S_BLACK, pos) &&
IsSelfAtari(game, S_WHITE, pos)) {
seki_candidate[pos] = true;
}
}

for (i = 0; i < MAX_STRING; i++) {
for (int i = 0; i < MAX_STRING; i++) {
// 連が存在しない,
// または連の呼吸点数が2個でなければ次を調べる
if (!string[i].flag || string[i].libs != 2) continue;
Expand All @@ -50,13 +49,13 @@ CheckSeki( const game_info_t *game, bool seki[] )
// 呼吸点1の周囲の連のIDを取り出す
GetNeighbor4(neighbor4, lib1);
lib1_ids = 0;
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
if (board[neighbor4[j]] == S_BLACK ||
board[neighbor4[j]] == S_WHITE) {
id = string_id[neighbor4[j]];
if (id != i) {
already_checked = false;
for (k = 0; k < lib1_ids; k++) {
for (int k = 0; k < lib1_ids; k++) {
if (lib1_id[k] == id) {
already_checked = true;
break;
Expand All @@ -71,13 +70,13 @@ CheckSeki( const game_info_t *game, bool seki[] )
// 呼吸点2の周囲の連のIDを取り出す
GetNeighbor4(neighbor4, lib2);
lib2_ids = 0;
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
if (board[neighbor4[j]] == S_BLACK ||
board[neighbor4[j]] == S_WHITE) {
id = string_id[neighbor4[j]];
if (id != i) {
already_checked = false;
for (k = 0; k < lib2_ids; k++) {
for (int k = 0; k < lib2_ids; k++) {
if (lib2_id[k] == id) {
already_checked = true;
break;
Expand Down Expand Up @@ -110,7 +109,7 @@ CheckSeki( const game_info_t *game, bool seki[] )
eye_condition[Pat3(game->pat, neighbor2_lib)] == E_COMPLETE_HALF_EYE) {
int tmp_id1 = 0, tmp_id2 = 0;
GetNeighbor4(neighbor4, neighbor1_lib);
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
if (board[neighbor4[j]] == S_BLACK ||
board[neighbor4[j]] == S_WHITE) {
id = string_id[neighbor4[j]];
Expand All @@ -122,7 +121,7 @@ CheckSeki( const game_info_t *game, bool seki[] )
}
}
GetNeighbor4(neighbor4, neighbor2_lib);
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
if (board[neighbor4[j]] == S_BLACK ||
board[neighbor4[j]] == S_WHITE) {
id = string_id[neighbor4[j]];
Expand Down
28 changes: 14 additions & 14 deletions src/UctRating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ using namespace std;
char uct_params_path[1024];

// w_0
double weight_zero;
static double weight_zero;
// 戦術的特徴のレート
latent_factor_t uct_tactical_features[UCT_TACTICAL_FEATURE_MAX];
static latent_factor_t uct_tactical_features[UCT_TACTICAL_FEATURE_MAX];
// 盤上の位置のレート
latent_factor_t uct_pos_id[POS_ID_MAX];
static latent_factor_t uct_pos_id[POS_ID_MAX];
// パスのレート
latent_factor_t uct_pass[UCT_PASS_MAX];
static latent_factor_t uct_pass[UCT_PASS_MAX];
// 直前の着手からの距離のレート
latent_factor_t uct_move_distance_1[MOVE_DISTANCE_MAX];
static latent_factor_t uct_move_distance_1[MOVE_DISTANCE_MAX];
// 2手前の着手からの距離のレート
latent_factor_t uct_move_distance_2[MOVE_DISTANCE_MAX];
static latent_factor_t uct_move_distance_2[MOVE_DISTANCE_MAX];
// 3x3パターンのレート
latent_factor_t uct_pat3[PAT3_LIMIT];
static latent_factor_t uct_pat3[PAT3_LIMIT];
// マンハッタン距離2のパターンのレート
latent_factor_t uct_md2[MD2_LIMIT];
static latent_factor_t uct_md2[MD2_LIMIT];
// マンハッタン距離3のパターンのレート
latent_factor_t uct_md3[LARGE_PAT_MAX];
static latent_factor_t uct_md3[LARGE_PAT_MAX];
// マンハッタン距離4のパターンのレート
latent_factor_t uct_md4[LARGE_PAT_MAX];
static latent_factor_t uct_md4[LARGE_PAT_MAX];
// マンハッタン距離5のパターンのレート
latent_factor_t uct_md5[LARGE_PAT_MAX];
static latent_factor_t uct_md5[LARGE_PAT_MAX];
// オーナーのレート
double uct_owner[OWNER_MAX];
// クリティカリティのレート
Expand All @@ -51,10 +51,10 @@ index_hash_t md3_index[HASH_MAX];
index_hash_t md4_index[HASH_MAX];
index_hash_t md5_index[HASH_MAX];

int pat3_index[PAT3_MAX];
int md2_index[MD2_MAX];
static int pat3_index[PAT3_MAX];
static int md2_index[MD2_MAX];

game_info_t snapback_game;
static game_info_t snapback_game;


// 戦術的特徴のビットマスク
Expand Down
Loading

0 comments on commit 7fb2f10

Please sign in to comment.