gochatai/pachi_py/pachi/patternsp.c
/* Compare two spatials, allowing for differences up to isomorphism.
 * True means the spatials are equivalent. */
Compare two spatials, allowing for differences up to isomorphism.
True means the spatials are equivalent.
Compare two spatials allowing for differences up to isomorphism . True means the spatials are equivalent .
static bool
spatial_cmp(struct spatial *s1, struct spatial *s2)
{
	if (s1->dist != s2->dist)
		return false;
	hash_t s1r[PTH__ROTATIONS];
	for (unsigned int r = 0; r < PTH__ROTATIONS; r++)
		s1r[r] = spatial_hash(r, s1);
	for (unsigned int r = 0; r < PTH__ROTATIONS; r++) {
		hash_t s2r = spatial_hash(r, s2);
		for (unsigned int p = 0; p < PTH__ROTATIONS; p++)
			if (s2r == s1r[p])
				goto found_rot;
		return false;
found_rot:;
	}
	return true;
}
static bool spatial_cmp ( struct spatial * s1 , struct spatial * s2 ) { if ( s1 -> dist != s2 -> dist ) return false ; hash_t s1r [ PTH__ROTATIONS ] ; for ( unsigned int r = 0 ; r < PTH__ROTATIONS ; r ++ ) s1r [ r ] = spatial_hash ( r , s1 ) ; for ( unsigned int r = 0 ; r < PTH__ROTATIONS ; r ++ ) { hash_t s2r = spatial_hash ( r , s2 ) ; for ( unsigned int p = 0 ; p < PTH__ROTATIONS ; p ++ ) if ( s2r == s1r [ p ] ) goto found_rot ; return false ; found_rot : ; } return true ; }
Compare two spatials, allowing for differences up to isomorphism.
Compare two spatials allowing for differences up to isomorphism .
/* Quick preliminary check. */ /* We could create complex transposition tables, but it seems most
	 * foolproof to just check if the sets of rotation hashes are the
	 * same for both. */ /* Rotation hash s2r does not correspond to s1r. */ /* All rotation hashes of s2 occur in s1. Hopefully that
	 * indicates something. */