Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: coding a chessposition into a integer value

Author: J. Wesley Cleveland

Date: 13:52:31 11/21/02

Go up one level in this thread


On November 20, 2002 at 11:24:39, Frank Sgarra wrote:

>
>
>ops, i forgot to mention that all 5 pieces are white pawns !

Try this:

Assuming that pawns are limited to the 2-7 ranks, the number of different
positions are 48!/(43!*5!) or 1712304. So, if we can enumerate the positions,
this will be the smallest integer. If the 5 pawns are on squares a,b,c,d,e where
a<b<c<d<e, we can calculate the number by adding the number of permutations of 5
pawn positions which have the first pawn on a square < a,
plus the number of permutations of 4 pawn positions which have the first pawn on
a square > a and < b, plus the number of permutations of 3 pawn positions which
have the first pawn on a square > b and < c, plus the number of permutations of
2 pawn positions which have the first pawn on a square > c and < d, plus e-d-1.
The number of permutations for 2-5 pawns can be put into tables making the
calculation 4 table lookups and a few adds.



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.