Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Minimum Number of Bytes - encode castling within kings coordinates

Author: Dann Corbit

Date: 11:05:45 12/24/03

Go up one level in this thread


On December 24, 2003 at 06:01:58, Reinhard Scharnagl wrote:

>On December 24, 2003 at 00:54:50, Russell Reagan wrote:
>
>>On December 23, 2003 at 23:58:19, Reinhard Scharnagl wrote:
>>
>>>you are describing just the big translation table, I have spoken of.
>>>
>>>I will try to explain the nature of a solution I would like to have
>>>(which is still not complete and in devlopment).
>>>
>>>Suppose the castling rigths are the following bits: bwl, bwr, bbl, bbr.
>>>
>>>a) if both kings are at original place,
>>>   encode Kw = kb = (bwl, bwr, 0, bbl, bbr, 0)
>>>b) if only the white king is at original place,
>>>   1) O-O only -> place him immediately over or under the black king
>>>   2) O-O-O only -> place him immediately right or left to the black king
>>>   3) both castlings -> ... still no idea, sorry
>>>c) if only the black king is at original place,
>>>   1) O-O only -> place him immediately NW or SE the white king
>>>   2) O-O-O only -> place him immediately NE or SW to the white king
>>>   3) both castlings -> ... still no idea, sorry
>>>
>>>That this moment is the direction I am thinking of a solution.
>>
>>Why do you only use the relative locations of the two kings? Instead of using
>>north, south, east, west, and combinations of those, why not do it like this:
>>
>>If white king on a1 and black king on b1, then ...
>>If white king on b1 and black king on c1, then ...
>>If white king on c1 and black king on d1, then ...
>>...
>>If white king on e4 and black king on d5, then ...
>>and so on...
>
>[...]
>
>That would have the form of a big cryptic translation table. I already have
>mentioned, that such a solution would WORK. But I do not like it, because it
>would not be a TRANSPARENT approach.
>
>Reinhard.

A simple approach that also uses a table...

Store the king positions in a table of two things, king postion bitmap and
color:
e.g.
[D]8/8/8/8/8/8/8/K1k5 w - -
becomes 0x5, 'W'
Now, your board position for any set of two kings is just the index into this
array.

I think it is easy to understand.



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.