gochatai/pachi_py/pachi/tactics/selfatari.c
/* Fast but there are issues with this (triangle six is not dead !)
 * We also need to know status if opponent plays first */
Fast but there are issues with this (triangle six is not dead !)
We also need to know status if opponent plays first
Fast but there are issues with this ( triangle six is not dead ! ) We also need to know status if opponent plays first
static inline int
nakade_making_dead_shape_hack(struct board *b, enum stone color, coord_t to, int lib2,
			      struct selfatari_state *s, int stones)
{
	int touch8 = neighbor_count_at(b, to, color);
	foreach_diag_neighbor(b, to) {
		if (board_at(b, c) != color) continue;
		if (board_group_info(b, group_at(b, c)).lib[0] == to
		    || board_group_info(b, group_at(b, c)).lib[1] == to)
			touch8++;
	} foreach_diag_neighbor_end;
	if (touch8 == stones)
		return true;
	if (s->groupcts[color] > 1)
		return false;
	if (stones == 3)   
		return false;
	if (stones < 3)    
		return true;
	int ltouch8 = neighbor_count_at(b, lib2, color);
	foreach_diag_neighbor(b, lib2) {
		if (board_at(b, c) != color) continue;
		if (board_group_info(b, group_at(b, c)).lib[0] == to
		    || board_group_info(b, group_at(b, c)).lib[1] == to)
			ltouch8++;
	} foreach_diag_neighbor_end;
	return ltouch8 == touch8;
}
static inline int nakade_making_dead_shape_hack ( struct board * b , enum stone color , coord_t to , int lib2 , struct selfatari_state * s , int stones ) { int touch8 = neighbor_count_at ( b , to , color ) ; foreach_diag_neighbor ( b , to ) { if ( board_at ( b , c ) != color ) continue ; if ( board_group_info ( b , group_at ( b , c ) ) . lib [ 0 ] == to || board_group_info ( b , group_at ( b , c ) ) . lib [ 1 ] == to ) touch8 ++ ; } foreach_diag_neighbor_end ; if ( touch8 == stones ) return true ; if ( s -> groupcts [ color ] > 1 ) return false ; if ( stones == 3 ) return false ; if ( stones < 3 ) return true ; int ltouch8 = neighbor_count_at ( b , lib2 , color ) ; foreach_diag_neighbor ( b , lib2 ) { if ( board_at ( b , c ) != color ) continue ; if ( board_group_info ( b , group_at ( b , c ) ) . lib [ 0 ] == to || board_group_info ( b , group_at ( b , c ) ) . lib [ 1 ] == to ) ltouch8 ++ ; } foreach_diag_neighbor_end ; return ltouch8 == touch8 ; }
Fast but there are issues with this (triangle six is not dead !)
Fast but there are issues with this ( triangle six is not dead ! )
/* It also remains to be seen whether it is nakade
	 * and not seki destruction. To do this properly, we
	 * would have to look at the group shape. But we can
	 * cheat too! Brett Combs helps to introduce a static
	 * rule that should in fact cover *all* cases:
	 * 1. Total number of pre-selfatari nakade stones must
	 *    be 5 or smaller. (See above for that.)
	 * 2. If the selfatari is 8-touching all nakade stones,
	 *    it is proper nakade.
	 * 3. Otherwise, there must be only a single nakade
	 *    group, it must be at least 4-stone and its other
	 *    liberty must be 8-touching the same number of
	 *    stones as us. */ /* Consider only internal stones. Otherwise, e.g.
		 * X O . X
		 * X . O X  can make trouble, bottom O is
		 * O X X X  irrelevant. */ // 4 stones and self-atari not 8-connected to all of them -> living shape // always dead shape