Computer Chess Club Archives


Search

Terms

Messages

Subject: Calculation the number of positions of KQQKQQ and KQQKQP

Author: Michel Langeveld

Date: 09:53:23 09/03/99


If did a try to calculate the number of bytes of KQQKQQ and KQQKQP. I'm sure it
can saved shorter than I tried. Please explain me where I made errors or missed
something. Thx!

Calculations of the number of bytes of KQQKQQ
=============================================

10 bytes for 1 king.

+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
|   1|    |
|  23|    |
| 456|    |
|7890|    |
+----+----+

You can convert a random position with one king the king into this triangle.

The Other king kan be on the folowing places:

+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
|   9|    |
|  99|    |
| 999|    |
|4666|    |
+----+----+

4 = 60 other places for blackking
6 = 58 other places for blackking
9 = 55 other places for blackking

So there are
1 x 4 = 1 x 60 =  60
3 x 6 = 3 x 58 = 174
6 x 9 = 6 x 55 = 330+
                 ---
                 564 positions for KK.

KQK
---
For adding the next queen there are 62 pieces left.

So you need for KQK 564 x 62 = 34.968 (for each color to move)

Note: This number doesn't match with Namilov's number (It's bigger) of KQK can
somebody tell me what's wrong??

KQKQ
----
When adding the next queen you need:

34.968 x 61 = 2.133.048 (for each color to move)

This can be optimised more because if a king of one site is in check the king of
the other site can't be in check...

for example if you have the folowing position
+----+----+
|k   |    |
|    |    |
|    |    |
|    |    |
+----+----+
|    |    |
|    |    |
|    |    |
|q   |   K|
+----+----+ white = lowcase) & black = upcase

The folowing fields are valid for white to move(upcase).

+----+----+
|k   |    |
|    |    |
|    |    |
|    |    |
+----+----+
|    |    |
|    |    |
|    |    |
|q$$$|$$$K|
+----+----+ white = lowcase) & black = upcase

other field are not possible since black is else in check and can't move.

KQQKQ
-----

For the endgame you need:
2.133.048 x 60 = 127.982.880 bytes

KQQKQQ
------

For this endgame you need:
127.982.880 x 59 = 7.550.989.920 bytes for each color.
So 15Gb will be enough for both colors for this endgame.

KQQKQP
======

On the endgame a diffent calculation is needed because the pawn can only walk to
one way. So If we begin with the king (maybe beginning with the piece with the
most possibilities is better??).

fields for the king (since we have a king we can't swap as much as without
pawns).
+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
|1234|    |
|5678|    |
|9012|    |
|3456|    |
+----+----+ = 16 fields

fiels for the other king =
+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
|6999|    |
|6999|    |
|6999|    |
|4666|    |
+----+----+ = 16 fields

4 = 60 other places for blackking
6 = 58 other places for blackking
9 = 55 other places for blackking

So there are
1 x 4 = 1 x 60 =  60
6 x 6 = 6 x 58 = 348
9 x 9 = 9 x 55 = 495+
                 ---
                 903 positions for KK (in a pawn endgame).

fields for the pawn
+----+----+
|....|....|
|1234|5678|
|9012|3456|
|7890|1234|
+----+----+
|5678|9012|
|3456|7890|
|1234|5678|
|....|....| = 48 fields
+----+----+

           KK     P   Q    Q    Q  col.
So we need 903 * 48 * 61 * 60 * 59 * 2 = 18.719.406.720 bytes

So about 19Gb for KQQKQP

Optimization
============
If you are only interested in win-draw-lose you might store can store 4
positions in 1 byte. Then you only need (15Gb + 19Gb) / 4 = 8.5Gb. And I have a
17Gb drive at home!!!

We can also optimise these endgames more because the pawns are already advance
to a certain rank!!!!!!!! I pawn can infact only move forward because if it
hight a piece to the right the we convert to an endgame we already have!!!!!

I've no idea how long it takes to generated this 2 endgames. I think if we
optimize it for the Kasparov - World it can be much smaller and faster then if
we generate them for general purpose.


Kind regards,

Michel Langeveld
Email: rudolf@stad.dsl.nl
Homepage: http://stad.dsl.nl/~rudolf



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.