How many different chess positions are there?

Sort:
varelse1

Four. Maybe even five.

TheGrobe

Incidentally, I'd think the optimal way to store the position would be as follows:

Each square can be indexed with six bits (2^6 = 64)

Only those squares with peices need be included in a particular positions representation, at which point the only other peice of information is which peice.  There are 12 types of peices (six of each colour) so this can be represented with a four bit number (2^4 = 16).

The ten bit combination of the two, then tells you which peice on which square.

A position would then be a collection of three to seven of these ten bit sequences (K vs K is trivial and not material in its contribution to the size) plus a capture of the signed integer indicating the number of moves to mate, and for which side.  For this purpose we'll assume a signed word (+/- 32K).

Based on this, and the 140 TB figure for the Lomonosov tablebase, the absolute upper bound would be taken by assuming every position is as small as possible (three peices, or 30 bits -- we'll assume 32 since this is how it would end up being allocated) plus another 16 bits for the signed word meaning each position could be as small as 6 bytes (up to 12 bytes for positions with seven peices):

140 TB/6 bytes = 2.56552713 × 10^13

This does not take into account any storage dedicated to the overcome the inherent difficulty that this scheme would have indexing these for fast lookup in order to present the position and legal subsequent positions on the fly as described above, and also assumes every position is only three peices and so as a result represents the absolute upper bound for a seven peice tablebase.

watcha
TheGrobe wrote:

140 TB/6 bytes = 2.56552713 × 10^13

If we are talking about an absolute upper bound then we can assume that we have a perfect hash. A perfect hash would mean that a unique key is assigned to every position by the hashing algorythm and there are no collisions. In this case it is enough to generate the hash key for the position that we want to look up and use this as an index to the evaluation table which contains a 2 byte integer for every position. This gives 140 TB / 2 bytes in your notation. ( Wikipedia says 100 TB for the size, but I also remember to have read the 140 TB figure somewhere, just could not find that source, so I did not feel legitimate to use this number. )

TheGrobe

140 TB is referenced here:

http://chessok.com/?page_id=27966

There is also some further compression available through position equivalence.  The scheme above already has a x2 equivalence factor for who's turn it is to move (chage the turn, change the colours and you have the same position), but any position without pawns is also equivalent to a number of others through rotations and reflections and positions with pawns have one equivalent horiztonal reflection.  These too could be resolved on the fly.

The_Ghostess_Lola

Grobe wrote:

....any position without pawns is also equivalent to a number of others through rotations and reflections and positions with pawns have one equivalent horiztonal reflection.

Good pointout Grobe....and wouldn't we also have a vertical reflection with pawns aboard (just change the colors) or would that just be a 180 degree rotation ?....I'm so far over my head with you guys (but I'm trying !)....  

The_Ghostess_Lola

....and varelse1 ?....the question is "....chess positions out there ?"

(....and I think more like seven. One for each day of the week !....Smile....)  

DiogenesDue

These musings all suppose fairly standard, current computer technologies.  In the future though, you might be using computers with ternary "bit" values...instead of binary 0s and 1s, you'd have atomic memory/storage:

0 = non-ionized atom

1 = ionized atom with right spin electron

2 = ionized atom with left spin electron

Carbon, specifically manufactured diamond crystal storage arrays, would be most likely.  Storage is obviously much greater, but so is calculation speed because of the time saved traversing atomic storage...everything closer together means the speed of light is less of a limiting factor.

http://physicsworld.com/cws/article/news/2012/jun/08/solid-state-quantum-memories-set-endurance-records

watcha
TheGrobe wrote:

140 TB is referenced here:

http://chessok.com/?page_id=27966

There is also some further compression available through position equivalence.  The scheme above already has a x2 equivalence factor for who's turn it is to move (chage the turn, change the colours and you have the same position), but any position without pawns is also equivalent to a number of others through rotations and reflections and positions with pawns have one equivalent horiztonal reflection.  These too could be resolved on the fly.

You can not double the calculated figure because of the turn since you only stored one evaluation per position ( assuming it is white's turn in every position, if it is black's turn you can look up the dual position ). You would run into redundancy only if you stored evaluations assuming both white's and black's turn in every position. So apart from symmetries the figure is correct.

I know there can be symmetries but I can't come up with any legitimate estimate on how many there are and in how many positions so I ignored them in my calculations alltogether.

TheGrobe

What I mean is that if you take a position, reverse the colours of the peices and change who's turn it is you have the equivalent position.  In my storage scheme I didn't dedicate a bit for who's turn it is for this reason.

watcha
TheGrobe wrote:

What I mean is that if you take a position, reverse the colours of the peices and change who's turn it is you have the equivalent position.  In my storage scheme I didn't dedicate a bit for who's turn it is for this reason.

I was thinking about what constitutes a dual position ( a position which has essentially the same consequences for white to move that the original one had for black to move ). I think that you need to mirror the board over the horizontal axis and then reverse colors. If you only reverse colors a white pawn one square away from promotion would become a black pawn on its original square for example which has essentially different consequences.

watcha
btickler wrote:

These musings all suppose fairly standard, current computer technologies.  In the future though, you might be using computers with ternary "bit" values...instead of binary 0s and 1s, you'd have atomic memory/storage:

0 = non-ionized atom

1 = ionized atom with right spin electron

2 = ionized atom with left spin electron

Carbon, specifically manufactured diamond crystal storage arrays, would be most likely.  Storage is obviously much greater, but so is calculation speed because of the time saved traversing atomic storage...everything closer together means the speed of light is less of limiting factor.

http://physicsworld.com/cws/article/news/2012/jun/08/solid-state-quantum-memories-set-endurance-records

I'm very much interested in the smallest space a bit of information can be stored on.

I made a calculation earlier in this thread showing that in Earth's oceans there are 4.45 * 10^46 water molecules ( I used this example because everyone can imagine how large the oceans are ). So even if you can store 1 bit of information on an atomic level, to store information on the order of 10^40+ bits becomes impracticable. Chess is believed to have legal positions on the order of 10^40+.

The_Ghostess_Lola

watcha writes:

I was thinking about what constitutes a dual position ( a position which has essentially the same consequences for white to move that the original one had for black to move ). I think that you need to mirror the board over the horizontal axis and then reverse colors. If you only reverse colors a white pawn one square away from promotion would become a black pawn on its original square for example which has essentially different consequences.

Mirroring and rotating gets sensitive with pawns on the board.  Also, watch out for castling. With these two entities kaput, then mirroring/rotating has no effect and we can consider it (equivalent symmetry ?) (1) position....and I think most would approve. And, I would think most would be okay with disregarding colors in the final tally. (e.g., WhKing (g6) WhRook (a8) BlKng (g8)....++....so, instead of (8) individual counts (4 for Wh and 4 for Bl....0, 90,180,270 degrees) we have (1)....agree ?)  

Too bad we can't eliminate the check and checkmate positions....for they too greatly expand the parameters and make our software filters calculate for legality....but we can't.

The_Ghostess_Lola
TheGrobe wrote:

What I mean is that if you take a position, reverse the colours of the peices and change who's turn it is you have the equivalent position.  In my storage scheme I didn't dedicate a bit for who's turn it is for this reason.

....and I agree w/ Grobe, does it matter whose move it is ? I don't believe so.  We're only (laughing when I say only) trying to create a unique board setup.

watcha

Consider the following position:

White is about to promote a pawn. If it is black to move what position with white's turn has the same consequence?

Let's code white pieces from 1 to 6 ( 1 being pawn, 6 being king ). Black pieces would have the same codes with negative sign.

The position as a matrix would look like this:

 

Mirroring over the horizontal axis and then reversing color in this notation has the transformation matrix:

If we perform the transformation we get:

Turning this back to a real chess position:

This position has the same consequences for white assuming it is white's turn than the original position had for black assuming black's turn.


watcha

If one wants to address the symmetries in chess it can be done by determining the symmetry transformation matrix ( in a similar way to the above example ) for each of those symmetries and the conditions under which those symmetries can be applied. The above transformation could be called the 'turn symmetry' and it can be applied to every position.

einstein99

More than a million but less than a kazillion!

watcha

To compute the evaluation of a position under turn symmetry let's assume that we have a function ' v ' which takes as arguments the side to move ( t = 1 for white, t = -1 for black ) and the matrix of the position ( P ) and returns the value of the position from white's perspective ( 0 for an objective draw or a positive integer telling the smallest amount of moves in which white can force a mate or a negative integer whose absolute value tells the smallest amount of moves in which black can force a mate ) :

Let's call the matrix of the turn symmetry transformation ' T ' :

With these notations the following relationship should hold:

The_Ghostess_Lola

I like how you've applied this linear algebra thing....it seems like it should hold. My comment is that....do we care whose move it is ?....assuming the board is always "White plays from 270 degrees - black plays from 90 degrees" then these positions are ='ly symmetrical....therefore, (1) position....irrespective of "White to Move or Black to Move".

Maybe at this point I need clarification/definition on "Unique Positions"....because I see the examples above as (1) count....Smile....

watcha

At least we know the number of possible positions of the Rubik's Cube:

The_Ghostess_Lola

Love it !!....Love it so !!....Smile....