@@ -40,6 +40,7 @@ int board_y[BOARD_MAX]; // y方向の座標
4040
4141unsigned char eye[PAT3_MAX ]; // 目のパターン
4242unsigned char false_eye[PAT3_MAX ];
43+ unsigned char falsy_eye[PAT3_MAX ];
4344unsigned char territory[PAT3_MAX ]; // 領地のパターン
4445unsigned char nb4_empty[PAT3_MAX ]; // 上下左右の空点の数
4546unsigned char eye_condition[PAT3_MAX ];
@@ -547,6 +548,16 @@ InitializeEye( void )
547548 // XOO XOX ### ###
548549 0x5965 , 0x9955 , 0xFD56 , 0xFF76 ,
549550 };
551+ const int falsy_eye_pat3[] = {
552+ // XOO XO+ XO+
553+ // O*O O*O O*O
554+ // OOX OOX +OX
555+ 0x9556 , 0x9546 , 0x9146 ,
556+ // XOX XOX XOX
557+ // O*O O*O O*O
558+ // OOO OO+ +O+
559+ 0x5566 , 0x5166 , 0x1166 ,
560+ };
550561
551562 const unsigned int complete_half_eye[12 ] = {
552563 // XOX OOX XOX XOX XOX
@@ -664,6 +675,14 @@ InitializeEye( void )
664675 }
665676 }
666677
678+ for (int p : falsy_eye_pat3) {
679+ Pat3Transpose8 (p, transp);
680+ for (int j = 0 ; j < 8 ; j++) {
681+ falsy_eye[transp[j]] = S_BLACK ;
682+ falsy_eye[Pat3Reverse (transp[j])] = S_WHITE ;
683+ }
684+ }
685+
667686}
668687
669688
@@ -957,6 +976,59 @@ IsLegalNotEye( game_info_t *game, const int pos, const int color )
957976}
958977
959978
979+ bool
980+ ReplaceMove ( game_info_t *game, const int pos, const int color, int * replace, int * replace_num )
981+ {
982+ const int *string_id = game->string_id ;
983+ const string_t *string = game->string ;
984+ int other = FLIP_COLOR (color);
985+
986+ // 眼
987+ if (eye[Pat3 (game->pat , pos)] != color ||
988+ string[string_id[NORTH (pos)]].libs == 1 ||
989+ string[string_id[EAST (pos)]].libs == 1 ||
990+ string[string_id[SOUTH (pos)]].libs == 1 ||
991+ string[string_id[WEST (pos)]].libs == 1 ) {
992+
993+ // 欠け眼に見える眼
994+ if (falsy_eye[Pat3 (game->pat , pos)] == color &&
995+ string[string_id[NORTH (pos)]].libs > 1 &&
996+ string[string_id[EAST (pos)]].libs > 1 &&
997+ string[string_id[SOUTH (pos)]].libs > 1 &&
998+ string[string_id[WEST (pos)]].libs > 1 ) {
999+ int check[] = {
1000+ NORTH_WEST (pos),
1001+ NORTH_EAST (pos),
1002+ SOUTH_WEST (pos),
1003+ SOUTH_EAST (pos),
1004+ };
1005+ for (int p : check) {
1006+ if (game->board [p] != other)
1007+ continue ;
1008+ const string_t *s = &string[string_id[p]];
1009+ if (s->libs == 1 ) {
1010+ int lib = s->lib [0 ];
1011+ replace[(*replace_num)++] = lib;
1012+ } else if (s->libs <= 2 ) {
1013+ int lib = s->lib [0 ];
1014+ while (lib != LIBERTY_END ) {
1015+ // int neighbor = string[id].neighbor[0];
1016+ if (IsCapturableAtariForSimulation (game, lib, color, string_id[p])) {
1017+ replace[(*replace_num)++] = lib;
1018+ }
1019+ lib = s->lib [lib];
1020+ }
1021+ }
1022+ }
1023+ return true ;
1024+ }
1025+ }
1026+
1027+
1028+ return false ;
1029+ }
1030+
1031+
9601032// //////////////////
9611033// 自殺手の判定 //
9621034// //////////////////
0 commit comments