A single integer N = a complete chess game

Ralf Stephan ralf at ark.in-berlin.de
Thu Apr 10 18:29:35 CEST 2008


You wrote 
> >  What would be the most "economical way" to assign a single number
> >  to a complete chess game? I guess this number would be of googol-
> >  length...
> 
> it is sufficient to use the number obtained from concatenating initial
> and final square of each move, i.e.
> G = sum( (a.i+64b.i)*64^2i )
> where i is the half-move, and a.i, b.i is starting / ending square

You'll need additional bits for underpromotion, i.e., creating
a rook instead of a ueen from a pawn.

This scheme, in summary, will need 18 bits per move.

You can do much better by creating a list of all possible
moves from the start position, and choosing a predefined order,
finding the move position in that list; and doing so for all
possible positions. Now, there is a maximum of moves from any
position, should be less than 176 (what is it exactly?).
So, you need only 8 bits per move.

Now with a theoretical maximum of 5000? moves (in practice 200
but with the new endgame rules there's more possible) your number
is less than 2^200, but certainly less than 2^5000 or so.
That is, about 30 and 1500 digits, respectively.

Regards,
ralf





More information about the SeqFan mailing list