Author: KarinsDad
Date: 19:09:16 12/23/03
Go up one level in this thread
On December 23, 2003 at 21:23:42, Reinhard Scharnagl wrote: >As I have mentioned in another reply, it is not as easy to encode that, because >of the fact, that when one king has been moved, castling might still be possible >for the other one. > >Sure, it might be possible to manage this encoding by a 'translation' table, >which allows changing illegal kings' positions into special situations with >different castling rights. But for me this method seems not to be transparent. Ease of encoding is irrelevant. Transparency is irrelevant. You wouldn't want minimum size positions in a chess playing program anyway. You wouldn't even want it in a chess storage position program since it is easier to store the first position (if not starting position) followed by all of the moves. If you do easy encoding, you will get nowhere near 20 bytes (at least my current goal). We are talking the minimum size here, not the minimum size if every position is easy to encode. And, this is actually trivial to encode/decode. x = 12 king bits Encode case: if ( no rooks can castle ) // whatever logic you use for that depending on the source of your position, if you have that knowledge for the simpler encoding mechanism, you have the same logic for the 2 bit fewer compression { x = a1a1; } else if ( white king rook can only castle ) { x = b1b1; } else if ( white queen rook can only castle ) { x = c1c1; } ... else if ( all rooks can castle ) { x = h2h2; } Decode case: switch(x): { a1a1: KingsCastlingPosition( e1, e8, false, false, false, false ); break; b1b1: KingsCastlingPosition( e1, e8, false, false, false, true ); break; c1c1: KingsCastlingPosition( e1, e8, false, false, true, false ); break; d1d1: KingsCastlingPosition( e1, e8, false, false, true, true ); break; ... h2h2: KingsCastlingPosition( e1, e8, true, true, true, true ); break; default: KingsCastlingPosition( x / 64, x % 64, false, false, false, false ); }
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.