Computer Chess Club Archives


Search

Terms

Messages

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

Author: KarinsDad

Date: 22:52:18 12/23/03

Go up one level in this thread


On December 24, 2003 at 01:06:30, Russell Reagan wrote:

>If you were able to get rid of the castling rights by the method I mentioned in
>my other post, you could do this (I think):
>
>1. filling matrix: 62 bit (one bit for each square 0...63, excluding kings)
>2. white king's position: 6 bit (coordinate 0...63, castling rights included
>here)
>3. black king's position: 6 bit (coordinate 0...63, castling rights included
>here)
>4. active color: 1 bit
>5. e.p. flag: 1 bit
>6. e.p. column of pawn (if need be): 3 bit (column 0...7)
>7. left pieces: 2...4 bit (from filling matrix, except K, castling R and P), no
>more than 81 bits
>
>This would require 160-bits at most. Surely further improvements are possible.
>One I can think of is that if the e.p. flag is 0, then we can use the other
>3-bits for something (or get rid of them). If the e.p. flag is 1, then we can
>locate both the pawn that can be captured by the column, requiring the 3-bits
>you have already accounted for, and we can also know the location of the
>capturing pawn with 1-bit (left or right of the threatened pawn). In either
>case, you can save at least one bit, so we should be down to 159-bits.


Except if the rooks do not castle, they could be anywhere.

Standard encoding for a position with no captures yet yields:

62 bit piece/pawn location
12 bit kings and castling info
30 bits (max) piece or pawn
16 bits (max) pawn color
48 bits (max) piece type and color
1 bit side to move
3 bits e.p. (if necessary, the other e.p. bit isn't needed)

So, we are at 172 bits max for the normal encoding. Capturing a pawn with
another pawn drops a pawn color bit and a piece/pawn bit, but there are now 3
remaining pawns that could promote and change to pieces for a net gain of 4 more
bits (+6 - 2), etc.

There are ways to decrease this, but they are tricky.



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.