thomasahle / sunfish

Sunfish: a Python Chess Engine in 111 lines of code
https://www.chessprogramming.org/Sunfish
Other
2.91k stars 535 forks source link

Sunfish keeps playing g1f3 illegally #114

Open Weragin opened 5 months ago

Weragin commented 5 months ago

I am using base python interpreter to run sunfinsh. With

position rnb1kbnr/pp2pppp/8/8/2pNP3/8/PP3PPP/RNB1KB1R b KQkq - 0 1
go movetime 25000

the engine says

bestmove g1f3 

which is an illegal move. Since the engine treats every position as playing white, could it have meant g8f6?

The full output is

info depth 1 time 81 nodes 8 nps 99 score cp 37 lowerbound pv g1f3 g8f6 b1c3 d7d5 e2e3 b8c6 f1b5 a7a6 b5c6 b7c6 e1g1
info depth 1 time 81 nodes 10 nps 123 score cp 46 upperbound
info depth 2 time 83 nodes 72 nps 864 score cp 36 upperbound
info depth 2 time 83 nodes 75 nps 899 score cp -9 lowerbound pv g1f3 g8f6 b1c3 d7d5 e2e3 b8c6 f1b5 a7a6 b5c6 b7c6 e1g1
info depth 2 time 88 nodes 193 nps 2203 score cp 12 upperbound
info depth 2 time 88 nodes 212 nps 2403 score cp 4 lowerbound pv g1f3 g8f6 d2d4 d7d5 b1c3 b8c6 c1f4 c8f5
info depth 3 time 93 nodes 327 nps 3533 score cp 10 lowerbound pv g1f3 g8f6 b1c3 d7d5 d2d4 b8c6 c1f4 c8f5
info depth 3 time 94 nodes 379 nps 4014 score cp 115 upperbound
info depth 3 time 95 nodes 406 nps 4284 score cp 52 upperbound
info depth 3 time 104 nodes 618 nps 5929 score cp 32 lowerbound pv g1f3 g8f6 b1c3 d7d5 d2d4 b8c6 c1f4 c8f5
info depth 3 time 106 nodes 667 nps 6314 score cp 41 upperbound
info depth 4 time 140 nodes 1558 nps 11130 score cp 36 upperbound
info depth 4 time 142 nodes 1605 nps 11342 score cp -54 lowerbound pv g1f3 g8f6 b1c3 b8c6 e2e4 e7e5 d2d4 e5d4 f3d4 d7d5
info depth 4 time 142 nodes 1634 nps 11470 score cp -9 lowerbound pv g1f3 g8f6 b1c3 b8c6 e2e4 e7e5 d2d4 e5d4 f3d4 d7d5
info depth 4 time 187 nodes 2945 nps 15757 score cp 13 upperbound
info depth 4 time 190 nodes 3072 nps 16127 score cp 3 lowerbound pv g1f3 g8f6 b1c3 b8c6 e2e4 e7e5 d2d4 e5d4 f3d4 d7d5
info depth 5 time 229 nodes 3959 nps 17274 score cp 9 lowerbound pv g1f3 g8f6 d2d4 d7d5 b1c3 b8c6 c1f4 c8f5
info depth 5 time 231 nodes 4021 nps 17390 score cp 88 upperbound
info depth 5 time 260 nodes 4886 nps 18818 score cp 48 upperbound
info depth 5 time 290 nodes 5927 nps 20472 score cp 28 upperbound
info depth 5 time 327 nodes 7195 nps 22002 score cp 18 upperbound
info depth 6 time 925 nodes 23711 nps 25628 score cp 13 upperbound
info depth 6 time 927 nodes 23772 nps 25648 score cp -51 lowerbound pv g1f3 b8c6 d2d4 g8f6 d4d5 c6b4 b1c3
info depth 6 time 943 nodes 24237 nps 25697 score cp -19 lowerbound pv g1f3 b8c6 d2d4 g8f6 d4d5 c6b4 b1c3
info depth 6 time 996 nodes 25564 nps 25666 score cp -3 lowerbound pv g1f3 b8c6 d2d4 g8f6 d4d5 c6b4 b1c3
info depth 6 time 1101 nodes 27678 nps 25145 score cp 5 lowerbound pv g1f3 b8c6 e2e4 g8f6 b1c3 e7e5 d2d4 e5d4 f3d4 d7d5
info depth 7 time 1739 nodes 35898 nps 20645 score cp 9 lowerbound pv g1f3 b8c6 e2e4 g8f6 b1c3 e7e5 f1c4 f8c5
info depth 7 time 1766 nodes 36878 nps 20880 score cp 241 upperbound
info depth 7 time 1773 nodes 37330 nps 21057 score cp 123 upperbound
info depth 7 time 1846 nodes 39781 nps 21552 score cp 65 upperbound
info depth 7 time 2302 nodes 53599 nps 23282 score cp 36 upperbound
info depth 7 time 2795 nodes 64798 nps 23180 score cp 23 lowerbound pv g1f3 b8c6 d2d4 d7d5 b1c3 g8f6 c1f4 c8f5
info depth 8 time 5269 nodes 121626 nps 23085 score cp 29 upperbound
info depth 8 time 5294 nodes 122595 nps 23159 score cp -331 lowerbound pv g1f3 b8c6 d2d4 d7d5 b1c3 g8f6 c1f4 c8f5
info depth 8 time 5297 nodes 122865 nps 23195 score cp -143 lowerbound pv g1f3 b8c6 d2d4 d7d5 b1c3 g8f6 c1f4 c8f5
info depth 8 time 5306 nodes 123442 nps 23265 score cp -55 lowerbound pv g1f3 b8c6 d2d4 d7d5 b1c3 g8f6 c1f4 c8f5
info depth 8 time 5538 nodes 130134 nps 23497 score cp -13 lowerbound pv g1f3 b8c6 d2d4 d7d5 b1c3 g8f6 c1f4 c8f5
info depth 8 time 16824 nodes 330179 nps 19626 score cp 7 upperbound
bestmove g1f3
Weragin commented 5 months ago

It can't mean g8f6 since it is one of the pv-s

Weragin commented 5 months ago

Actually, it always plays g1f3