Attempt 15: calculate index spaces for more men for chess
From a question (@Dann Corbit) about the limit of the generator, we have checked and added all necessary code/modifications to make sure the generator can work with more men for chess endgames.
When indexing, the generator combines similar chess pieces to save their index space. For example, two different chess pieces (say, a Rook and a Knight “rn”) have index space of 64 x 64 = 4,096, but the combination of two Rooks “rr” takes only 2016, saving more than half of the space. More similar pieces, much more savings. The previous code missed combinations for more than 3 pieces thus they can’t work with more than 3 attackers (5 men). Theoretically, a chess position can have a maximum of 10 similar pieces (say, 10 white Rooks). After adding the necessary code we could run the generator for more pieces of endgames.
That doesn’t mean we can build EGTBs easily for higher numbers of men since we are hardly limited by hardware and time to generate those endgames. For example, to build a 7-man EGTB, the Lomonosov team had to use supercomputers running multiple months to build it. We should use similar computing power to build our 7-man EGTB too which is too expensive and out of reach for almost all of us. Instead, we will get some interesting information with those EGTBs (higher numbers of pieces).
The generator can receive the name of endgames from command line arguments (e.g., “-n krkp”). If we give it the number of attackers, say -n 5, it will add all valid configurations of 5 attackers, plus all valid configurations of defenders (in the case of chess, it’s two Kings only, the total is 5+2 = 7 men).
With the argument “-subinfo” the generator will list all sub-endgames with their index size.
6 men
Command line:
The generator prints out:
Code: Select all
1) knk 36'096
2) kbk 36'096
3) krk 36'096
4) kqk 36'096
…
175) krbkrb 9'462'349'824
176) krrknn 2'292'240'384
177) krrkbn 4'657'250'304
…
509) kpppkp 1'499'355'648
510) kppppk 351'411'480
Total endgames: 510, total size: 3'421'720'926'408
One of the largest endgames: krkbnp, size: 22'724'739'072
The largest endgames have an index size of about 22 G, we need at least 22 x 2 = 44 GB RAM (to allocate two arrays for two sides, 1 byte per item). We may (highly likely) need to double that size (88 GB) if each item needs to be 2 bytes. The computers with that size of RAM are not cheap but still reachable for many of us.
In Attempt 12 we generated a 5-man EGTB, the index size is 21 G, the EGTB after compressing is 8.8 GB, and we have a compress ratio of 8.8 / 21 = 0.42. This 6-man has an index size of 3421 G. If we have a similar compression ratio, the size should be 3421 G x 0.42 = 1,436.82 GB = 1.44 TB. That size is larger than 1.2 TB of Nalimov 6-man but they all are still on the same level.
That size is about 163 times larger than a 5-man one. We have built 5-man in 17 hours. If we use the same computer, the new one may take 17 hours x 163 = 2,771 hours = 115.5 days.
Building 6-men EGTB is difficult, long time and not cheap. But it’s clearly feasible.
7 men
Code: Select all
1379) kqbppkq 534'031'368'192
1380) kqbnpkp 1'090'787'475'456
...
1467) krpppkr 127'945'015'296
1468) krnppkp 400'523'526'144
...
1510) kppppkp 16'867'751'040
1511) kpppppk 3'092'421'024
Total endgames: 1511, total size: 439'858'437'385'704
One of the largest endgames: kqkrbnp, size: 1'454'383'300'608
We need a computer with 1.5x2x2 = 6 TB RAM (2 sides x 2 bytes) to fit the largest endgames. The EGTB index size is about 440 T, equal to 440 T x 0.42 = 185 TB. That is significantly larger than 140 TB of Lomonosov 7-man EGTB, but the number looks reasonable and on the same level too.
Look like we cannot build 7-men without having very expensive computers.
8 men
Code: Select all
581) kqrkrrr 96'249'839'616
582) kqrkqnn 298'064'019'456
583) kqrkqbn 605'590'388'736
...
1568) kqnkrnnn 6'159'989'735'424
1569) kqnkrbnn 19'076'097'245'184
...
1657) krbnkrnn 19'076'097'245'184
1658) krbnkrbn 38'757'784'879'104
1659) krbbknnn 3'031'869'947'904
...
4030) kpppppkp 148'436'209'152
4031) kppppppk 22'162'350'672
Total endgames: 4031, total size: 47'556'659'223'031'800
One of the largest endgames: kqnkrbnp, size: 93'080'531'238'912
EGTB size should be around 48 P x 0.42 = 20 PB.
We can’t build this EGTB with current hardware as well as bigger ones anyway.
9 men
Code: Select all
7192) kqbnnnpkq 946'803'528'695'808
7193) kqbnnnnkp 225'605'528'322'048
7194) kqbbnnpkn 1'443'111'830'028'288
…
9750) kppppppkp 1'063'792'832'256
9751) kpppppppk 132'974'104'032
Total endgames: 9751, total size: 4'272'270'680'220'272'472
One of the largest endgames: kqbnkrbnp, size: 5'957'153'999'290'368
EGTB size should be around 4'272 P x 0.42 = 1794 PB
10 men
Some integer variants of 64-bit became overflow. We have to change them into unsigned 64-bit.
Code: Select all
19861) kqrpppkbnn 16'507'977'653'551'104
19862) kqrpppkbbn 16'507'977'653'551'104
19863) kqrpppkbbb 5'330'701'117'292'544
19864) kqrpppkrnn 16'507'977'653'551'104
19865) kqrpppkrbn 33'540'018'089'754'624
…
21940) kpppppppkp 6'382'756'993'536
21941) kppppppppk 681'492'283'164
Total endgames: 21941, total size: 4'202'946'837'452'060'244
One of the largest endgames: kqrbnkrbnp, size: 381'257'855'954'583'552
The index size is about 4203 P, smaller than 9 men. We guest the variant for the total number (it is an unsigned 64-bit integer) is overflowed. However, the number of endgames and their sizes are still valid and good for reference.
11 men
We have to wait a very long time (over 1 hour) when the program is computing for 11 men. Since this computing is very rare to run, we didn’t try to speed up the code.
Code: Select all
28952) kqrrbkqbbbp 1'908'755'913'850'748'928
28953) kqrrbkqrnnp 5'910'986'055'795'867'648
28954) kqrrbkqrbnp 12'009'622'462'569'381'888
28955) kqrrbkqrbbp 5'910'986'055'795'867'648
...
46240) kbpppppppkp 408'496'447'586'304
46241) krpppppppkp 408'496'447'586'304
46242) kqpppppppkp 408'496'447'586'304
46243) knppppppppk 43'615'506'122'496
46244) kbppppppppk 43'615'506'122'496
46245) krppppppppk 43'615'506'122'496
46246) kqppppppppk 43'615'506'122'496
46247) kpppppkpppp 601'723'282'849'920
46248) kppppppkppp 383'320'017'222'912
46249) kpppppppkpp 149'994'789'348'096
46250) kppppppppkp 32'711'629'591'872
Total endgames: 46250, total size: 6'501'485'980'035'256'340
One of the largest endgames: kqrbnpkrbnp, size: 18'300'377'085'820'010'496
A gain, the total size (6501 P) is incorrect because of being overflowed. The number of endgames and their sizes are still valid.
Fixing issues of being overflowed requires some good effort. Thus we stopped here.