Author: Sune Fischer
Date: 01:31:32 08/16/02
Go up one level in this thread
On August 15, 2002 at 17:13:23, Gerd Isenberg wrote: Looks interesting :) >bool sameSquareColor(int sq1, int sq2) { > return (combidist[sq1][sq2] & 1) == 0;} I think this one is faster without table lookup though: bool sameSquareColor(int sq1, int sq2) { return (((sq1^sq2)&1)^1); // or (!((sq1^sq2)&1)); } The above is derived from this observation: If sq1 and sq2 have the same color, they are equivalent modulo 2 since equals are black and unequals white (at least in my notation). so you can do bool isSquareWhite(int sq) { return (sq&1); } (I didn't test it, so check it:) -S. >Ok, there are lot of other ways to do it, but i like the information >"overloading" of this distance values. And i have a lot of lines inside my >program with this (dist == A && taxi == B) statements. > >Cheers, >Gerd
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.