gochatai/pachi_py/pachi/pattern.c
/* Match spatial features that are too distant to be pre-matched
 * incrementally. */
Match spatial features that are too distant to be pre-matched
incrementally.
Match spatial features that are too distant to be pre - matched incrementally .
struct feature *
pattern_match_spatial_outer(struct pattern_config *pc, pattern_spec ps,
                            struct pattern *p, struct feature *f,
		            struct board *b, struct move *m, hash_t h)
{
	static enum stone bt_black[4] = { S_NONE, S_BLACK, S_WHITE, S_OFFBOARD };
	static enum stone bt_white[4] = { S_NONE, S_WHITE, S_BLACK, S_OFFBOARD };
	enum stone (*bt)[4] = m->color == S_WHITE ? &bt_white : &bt_black;
	for (unsigned int d = BOARD_SPATHASH_MAXD + 1; d <= pc->spat_max; d++) {
		for (unsigned int j = ptind[d]; j < ptind[d + 1]; j++) {
			ptcoords_at(x, y, m->coord, b, j);
			h ^= pthashes[0][j][(*bt)[board_atxy(b, x, y)]];
		}
		if (d < pc->spat_min)
			continue;
		unsigned int sid = spatial_dict_get(pc->spat_dict, d, h & spatial_hash_mask);
		if (sid > 0) {
			f->id = FEAT_SPATIAL;
			f->payload = sid;
			if (!pc->spat_largest)
				(f++, p->n++);
		} 
	}
	return f;
}
struct feature * pattern_match_spatial_outer ( struct pattern_config * pc , pattern_spec ps , struct pattern * p , struct feature * f , struct board * b , struct move * m , hash_t h ) { static enum stone bt_black [ 4 ] = { S_NONE , S_BLACK , S_WHITE , S_OFFBOARD } ; static enum stone bt_white [ 4 ] = { S_NONE , S_WHITE , S_BLACK , S_OFFBOARD } ; enum stone ( * bt ) [ 4 ] = m -> color == S_WHITE ? & bt_white : & bt_black ; for ( unsigned int d = BOARD_SPATHASH_MAXD + 1 ; d <= pc -> spat_max ; d ++ ) { for ( unsigned int j = ptind [ d ] ; j < ptind [ d + 1 ] ; j ++ ) { ptcoords_at ( x , y , m -> coord , b , j ) ; h ^= pthashes [ 0 ] [ j ] [ ( * bt ) [ board_atxy ( b , x , y ) ] ] ; } if ( d < pc -> spat_min ) continue ; unsigned int sid = spatial_dict_get ( pc -> spat_dict , d , h & spatial_hash_mask ) ; if ( sid > 0 ) { f -> id = FEAT_SPATIAL ; f -> payload = sid ; if ( ! pc -> spat_largest ) ( f ++ , p -> n ++ ) ; } } return f ; }
Match spatial features that are too distant to be pre-matched
 incrementally.
Match spatial features that are too distant to be pre - matched incrementally .
/* We record all spatial patterns black-to-play; simply
	 * reverse all colors if we are white-to-play. */ /* Recompute missing outer circles:
		 * Go through all points in given distance. */ /* Record spatial feature, one per distance. */ /* else not found, ignore */