Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: unique distance relationship

Author: Gerd Isenberg

Date: 14:13:23 08/15/02

Go up one level in this thread


On August 15, 2002 at 16:40:49, Leen Ammeraal wrote:

>This is excellent! Thanks.
>Leen

Thanks back, Leen

glad about it

just an idea, not yet implemented ...

I wrote a small command line program to print out some A*distance+1*taxidist
combinations, where A+1 is power of two, and i'm stil playing around with it.

One more piece of information may fit inside the UDR_Dist[64][64] Array at the
right (bit)place, whether both squares have same colors or not. One Shift left
(*2) and there is place for a new LSB. This becomes the semantic of "opposite
square color". It takes into account, that a queen on an opposite colored square
has less possibility in average to reach the other square (on same color the
queen may have two consecutive diagonal moves) and therefore is 1/32 more far
away :-)

UDR_Dist[0]
  16  33  64  97 128 161 192 225
  33  48  67  98 131 162 195 226
  64  67  80 101 132 165 196 229
  97  98 101 112 135 166 199 230
 128 131 132 135 144 169 200 233
 161 162 165 166 169 176 203 234
 192 195 196 199 200 203 208 237
 225 226 229 230 233 234 237 240

 x10 x21 x40 x61 x80 xA1 xC0 xE1
 x21 x30 x43 x62 x83 xA2 xC3 xE2
 x40 x43 x50 x65 x84 xA5 xC4 xE5
 x61 x62 x65 x70 x87 xA6 xC7 xE6
 x80 x83 x84 x87 x90 xA9 xC8 xE9
 xA1 xA2 xA5 xA6 xA9 xB0 xCB xEA
 xC0 xC3 xC4 xC7 xC8 xCB xD0 xED
 xE1 xE2 xE5 xE6 xE9 xEA xED xF0

If you want, they stil fit into an unsigned char. One and-operation and one
compare, to detect "same line" or "diagonal". The three MSBs stil represent the
distance.

bool isOpposition(int sq1, int sq2) {
   return combidist[sq1][sq2] == 64;}

bool isKnightDistance(int sq1, int sq2) {
   return combidist[sq1][sq2] == 67;}

bool sameSquareColor(int sq1, int sq2) {
   return (combidist[sq1][sq2] & 1) == 0;}

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.01 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.