Bored with orthodox Chess?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

I grant wishes for those who mention my name :)

Browsing through the threads I see that "three king promotion" is not allowed by winboard ? If that is so then my perft numbers need to be fixed.
Which fairy-max version plays Spartan and where can I download it ?

Thanks
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

The latest Fairy-max sources are always in my on-line repository at http://hgm.nubati.net . A binary is included in the WinBoard install at http://hgm.nubati.net/WinBoard-4.5.0.exe . No separate download yet, sorry! Pawel's Oberon is about equally strong, btw, and more versatile, as it sometimesplays under-promotions,while Fairy-Maxis limited to promoting to Queen /Warlord. (Link can be found higher up in this thread.)

Not much success perfting with Fairy-Max yet. For normal Chess perft 1-4 are OK, but perft(5) is too large. And not always the same??? :shock:
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

OK, fixed it. I had disabled IID in the wrong way. I should at least do the d=0 iteration, to spot any King captures before any legal moves have been done.

Code: Select all

new
variant spartan
time 100000
go
a2a4         0
a2a3         0
b2b4         0
b2b3         0
c2c4         0
c2c3         0
d2d4         0
d2d3         0
e2e4         0
e2e3         0
f2f4         0
f2f3         0
g2g4         0
g2g3         0
h2h4         0
h2h3         0
b1c3         0
b1a3         0
g1h3         0
g1f3         0
#  0.         0
f2f4         1
f2f3         1
g2g4         1
g2g3         1
h2h4         1
h2h3         1
b1c3         1
b1a3         1
g1h3         1
g1f3         1
a2a4         1
a2a3         1
b2b4         1
b2b3         1
c2c4         1
c2c3         1
d2d4         1
d2d3         1
e2e4         1
e2e3         1
#  1.        20
d2d4        32
d2d3        32
e2e4        32
e2e3        32
f2f4        32
f2f3        32
g2g4        32
g2g3        32
h2h4        32
h2h3        32
b1c3        32
b1a3        32
g1h3        32
g1f3        32
a2a4        32
a2a3        32
b2b4        32
b2b3        32
c2c4        32
c2c3        32
#  2.       640
d2d4       896
d2d3       862
e2e4       961
e2e3       959
f2f4       641
f2f3       608
g2g4       674
g2g3       672
h2h4       672
h2h3       608
b1c3       704
b1a3       640
g1h3       640
g1f3       704
a2a4       672
a2a3       608
b2b4       674
b2b3       672
c2c4       705
c2c3       672
#  3.     14244
c2c4     23343
c2c3     22376
d2d4     29658
d2d3     28707
e2e4     31851
e2e3     31874
f2f4     21246
f2f3     20264
g2g4     22390
g2g3     22400
h2h4     22366
h2h3     20264
b1c3     23349
b1a3     21288
g1h3     21294
g1f3     23368
a2a4     22370
a2a3     20264
b2b4     22288
b2b3     22322
#  4.    473282
c2c4    576876
c2c3    539981
d2d4    867919
d2d3    792247
e2e4    987438
e2e3    983721
f2f4    474038
f2f3    430537
g2g4    514825
g2g3    520959
h2h4    525108
h2h3    434197
b1c3    561923
b1a3    476731
g1h3    476884
g1f3    560396
a2a4    523087
a2a3    434168
b2b4    516545
b2b3    514935
#  5.  11712515
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Thanks! It seems that I got it on my first try. There were some places I needed to take care of checks & in_checks with those multiple spartan kings and all. Other than that it was very similar to the orthodox. I should be able to finish a very weak engine with no eval this weak. It can also play Go, reversi and checkers... This is probably stupid of me to ask but I will say it anyway. Is there a possiblity to play these alein games in Winboard with legality testing turned off? The "drop" moves should be already included for crazyhouse, which I can use for Go moves. Also all my FEN and moves are very chessic and I think it can handle them.

Daniel
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

After almost exactly an hour of crunching, perft(6) appeared. But it is different from yours! :cry:

Code: Select all

g1h3  16576919
g1f3  19428214
a2a4  18212175
a2a3  15137201
b2b4  17767267
b2b3  17852989
c2c4  19904214
c2c3  18781609
d2d4  29930527
d2d3  27586700
e2e4  34110467
e2e3  34143618
f2f4  16384078
f2f3  15006559
g2g4  17854666
g2g3  18167235
h2h4  18279353
h2h3  15137689
b1c3  19451039
b1a3  16560624
#  6. 406273143
Problem in using WB for games like Go, Checkers, Reversi is that it does not know the side effects of the moves. It would dutifully move a draughts chip from the from to the to square, but a piece you jump over would not be removed. Same if you surround a stone in Go, or the flipping of a row or column in Reversi.

It would not be extremely difficult to implement all that, of course (all very similar to what is already done for atomic captures). But I wonder if that is not a bit 'over the top'. From what I learned in Kanazawa I understood that the players of 'Amazons' would be very happy wth a GUI that would allow automatic engine-engine play. Amazons requires a 3-square move specification, though, and is thus even more different from Chess than the others. (No side effects to the moves, though.)

Perhaps this would be a good test position for duple-checks etc.

[d]2k2k2/7Q/3K4/8/8/8/R7/8 w - - 0 1

Code: Select all

h7h6         8
h7h5        10
h7h4        10
h7h3         9
h7h2        10
h7h1        10
h7g6        10
h7f5         6
h7e4        10
h7d3        10
h7c2         9
h7b1        10
h7g7         7
h7f7         7
h7e7         6
h7d7         6
h7c7         7
h7b7         7
h7a7        10
h7h8         6
h7g8         5
d6e6        10
d6d5        10
d6c5        10
d6e5        10
d6c6        10
d6d7         0
d6e7         0
d6c7         0
a2b2        10
a2c2         6
a2d2        10
a2e2        10
a2f2         7
a2g2        10
a2h2        10
a2a1        10
a2a3        10
a2a4        10
a2a5        10
a2a6        10
a2a7        10
a2a8         3
#  2.       349
h7h6       258
h7h5       295
h7h4       297
h7h3       292
h7h2       261
h7h1       295
h7g6       280
h7f5       267
h7e4       338
h7d3       303
h7c2       257
h7b1       288
h7g7       232
h7f7       231
h7e7       192
h7d7       153
h7c7       196
h7b7       200
h7a7       262
h7h8       214
h7g8       158
d6e6       290
d6d5       400
d6c5       401
d6e5       400
d6c6       285
d6d7         0
d6e7         0
d6c7         0
a2b2       286
a2c2       164
a2d2       266
a2e2       288
a2f2       236
a2g2       286
a2h2       259
a2a1       287
a2a3       287
a2a4       287
a2a5       287
a2a6       252
a2a7       273
a2a8       106
#  3.     10609
h7h6      2429
h7h5      2934
h7h4      3026
h7h3      2814
h7h2      2748
h7h1      3055
h7g6      2625
h7f5      2201
h7e4      3346
h7d3      3193
h7c2      2542
h7b1      2965
h7g7      1970
h7f7      1808
h7e7      1525
h7d7      1160
h7c7      1479
h7b7      1660
h7a7      2509
h7h8      1666
h7g8      1177
d6e6      2736
d6d5      4054
d6c5      4070
d6e5      4061
d6c6      2610
d6d7         0
d6e7         0
d6c7         0
a2b2      2394
a2c2      1399
a2d2      2456
a2e2      2560
a2f2      1922
a2g2      2551
a2h2      2402
a2a1      2633
a2a3      2633
a2a4      2633
a2a5      2633
a2a6      2291
a2a7      2286
a2a8       530
#  4.     97686
a2b2     73976
a2c2     42029
a2d2     72574
a2e2     78954
a2f2     60700
a2g2     78558
a2h2     71158
a2a1     82013
a2a3     81942
a2a4     81798
a2a5     80122
a2a6     66530
a2a7     68152
a2a8     16525
h7h6     75487
h7h5     93016
h7h4     96197
h7h3     89165
h7h2     81610
h7h1     95738
h7g6     85145
h7f5     73398
h7e4    113017
h7d3    103112
h7c2     79209
h7b1     92731
h7g7     57033
h7f7     54920
h7e7     48152
h7d7     34555
h7c7     43282
h7b7     46619
h7a7     72139
h7h8     52024
h7g8     33401
d6e6     83254
d6d5    147914
d6c5    151816
d6e5    147377
d6c6     83097
d6d7         0
d6e7         0
d6c7         0
#  5.   3088439
a2b2    643185
a2c2    367358
a2d2    671182
a2e2    714629
a2f2    525590
a2g2    703335
a2h2    652459
a2a1    742711
a2a3    741612
a2a4    740609
a2a5    722459
a2a6    597393
a2a7    567270
a2a8    113110
h7h6    723512
h7h5    896478
h7h4    935046
h7h3    865385
h7h2    811857
h7h1    947939
h7g6    782277
h7f5    679920
h7e4   1085795
h7d3   1031658
h7c2    772964
h7b1    914308
h7g7    505403
h7f7    469622
h7e7    412063
h7d7    277464
h7c7    354063
h7b7    403748
h7a7    670602
h7h8    464703
h7g8    284817
d6e6    760263
d6d5   1472385
d6c5   1517799
d6e5   1470304
d6c6    756072
d6d7         0
d6e7         0
d6c7         0
#  6.  28769349
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Thanks! I am on to perft(6) with the divide like yours. Are three kings allowed in your perft btw ? In the one i posted they are.

About Winboard, something which takes a FEN string to update the whole board instead of just a move. Updating the board with just a move requires the GUI to know of the rules of the game. Keeping track of groups in GO for example is something I wouldn't wish for my worst enemy :) A bug there took me 3 days ... So the GUI can be dumb to the rules of the game which ofcourse is a problem as engines could send illegal positions.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

There are no promotions in perft(6), so the issue of 3 Kings would not come up. perft(9) is the first to probe white promotions, perft(10) black. Fairy-Max would get these wrong (next century...) anyway, because it only has promotion to Q or W. So it can never increase its King number.

Actually WinBoard already implements two (undocumented) engine->GUI commands like you describe. One is a regular setboard command, but sent by the engine. It sets up the board, but starts a new game as well (so you would have no history left to step through). The other is setup, which is only accepted from the first engine before the first move when legality testing is off (if the user did not set up a position). It is meant to set up the opening position in Chess variants WB does not know, and Fairy-Max uses it. Basically all that is needed would be to add a variant 'alien', which would allow the setup command on any move. This would be very easy to implement. The setup command sends both a FEN and a pieceToChar table that tells how the FEN should be interpreted.

In ICS mode WB in fact works exactly the way you describe; the ICS sends a board with every move, and WB uses that rather than derive the position from previous board plus move.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

HG, for the position you provided, can't one of the king's escape even if it is in a fork ? Nebiyu reports 400 for perft(2) for all whites moves. But fairy -max seems to think that when one of the king's becomes in check like after (h7h6), it thinks that the other king can not move into an attacked position. I think it can, because in the next move it can escape because it will be its turn to move i.e unless I mis-understood the rules.Isn't the rule to have at least one king at any time ?

Code: Select all

perft(2)
a2a3. 10
a2a4. 10
a2a5. 10
a2a6. 10
a2a7. 10
a2a8. 10
a2a1. 10
a2b2. 10
a2c2. 10
a2d2. 10
a2e2. 10
a2f2. 10
a2g2. 10
a2h2. 10
h7g6. 10
h7f5. 10
h7e4. 10
h7d3. 10
h7c2. 10
h7b1. 10
h7g8. 10
h7h8. 10
h7h6. 10
h7h5. 10
h7h4. 10
h7h3. 10
h7h2. 10
h7h1. 10
h7g7. 10
h7f7. 10
h7e7. 10
h7d7. 10
h7c7. 10
h7b7. 10
h7a7. 10
d6c5. 10
d6e5. 10
d6d5. 10
d6e6. 10
d6c6. 10
nodes 400
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

Yes, you misunderstood the rules. You cannot leave both Kings in check. That is not the same as not allowing both Kings to be captured on the next move. The latter would never be possible, as you can capture at most one piece per turn in Chess-like games. (Because such games have replacement capture, and you can move only one piece per turn.)

So if both Kings are under attack, at least one must step out of check. If it can't, you are checkmated. Like after

1.e4 Cd6 2.Qf3 Cb6 3.Qxf7 Wh6 4.a3 Kg8 5.Qxe8#

(Note that Qxf3 is not considered check.)
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Ok now problem is fixed. Somehow I thought of mating of only one king and infact went to extra length to implement it, when all I needed to do was !all_kings_attacked(player) for move legality test.
perft(6) is same as yours now :)

Code: Select all

b1c3. 19451039
b1a3. 16560624
g1h3. 16576919
g1f3. 19428214
h2h3. 15137689
h2h4. 18279353
d2d3. 27586700
d2d4. 29930527
g2g3. 18167235
g2g4. 17854666
e2e3. 34143618
e2e4. 34110467
f2f3. 15006559
f2f4. 16384078
c2c3. 18781609
c2c4. 19904214
a2a3. 15137201
a2a4. 18212175
b2b3. 17852989
b2b4. 17767267
nodes 406273143
time 140.67 sec