Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promotion bug : illegal move #1

Open
tissatussa opened this issue Apr 15, 2024 · 4 comments
Open

promotion bug : illegal move #1

tissatussa opened this issue Apr 15, 2024 · 4 comments

Comments

@tissatussa
Copy link

i compiled Kojiro on Linux (Xubuntu 22.04) and it runs fine in CuteChess (GUI) but sometimes it makes an illegal move concerning promotion .. here are two examples :

[Event "?"]
[Site "?"]
[Date "2024.04.14"]
[Round "?"]
[White "Kojiro v0.1"]
[Black "Kittycat"]
[Result "0-1"]
[FEN "rnbqkb1r/ppp2ppp/5n2/3pp3/8/3PP3/PPPNNPPP/R1BQKB1R b KQkq - 3 4"]
[PlyCount "121"]
[SetUp "1"]
[Termination "illegal move"]
[TimeControl "900+3"]

1... Nc6 {+0.60/7 75s} 2. Ng3 {-0.39/12 21s} Be6 {+0.70/7 69s}
3. Be2 {-0.20/12 21s} Bc5 {+0.65/7 64s} 4. O-O {+0.02/12 22s} Qd6 {+0.55/7 44s}
5. a3 {+0.30/11 22s} O-O {+0.60/7 42s} 6. b4 {+3.59/14 22s} Bb6 {-0.35/8 34s}
7. c4 {+5.67/14 22s} Nd7 {-0.30/7 37s} 8. c5 {+5.69/14 23s} Nxc5 {-0.50/8 35s}
9. bxc5 {+5.77/13 23s} Bxc5 {-0.50/7 33s} 10. Nb3 {+5.81/12 23s}
Bb6 {-0.50/7 32s} 11. d4 {+5.58/12 23s} e4 {-0.55/6 30s} 12. Qc2 {+6.01/12 23s}
Rad8 {-0.60/5 28s} 13. Nc5 {+6.05/12 23s} Bxc5 {-0.70/8 21s}
14. dxc5 {+6.11/13 23s} Qe7 {-0.75/8 22s} 15. Rb1 {+6.02/12 22s}
Rb8 {-0.75/7 24s} 16. Bb2 {+6.28/11 22s} Qg5 {-0.85/7 23s}
17. Rbd1 {+6.35/10 22s} Ne7 {-0.85/7 19s} 18. Qa4 {+6.65/10 22s}
a6 {-0.80/7 21s} 19. Qc2 {+6.17/11 22s} Rfe8 {-0.75/6 20s}
20. Nh5 {+6.22/11 21s} Red8 {-0.90/6 19s} 21. h4 {+7.36/13 21s}
Qg6 {-1.35/7 14s} 22. Bxg7 {+7.29/12 21s} Bh3 {-1.40/6 17s}
23. Nf4 {+7.22/14 21s} Qxg7 {-1.75/7 16s} 24. Nxh3 {+7.13/13 20s}
Qe5 {-1.75/6 16s} 25. h5 {+7.14/11 20s} Nf5 {-1.80/6 15s} 26. Qb3 {+7.05/12 20s}
d4 {-1.75/7 11s} 27. Bc4 {+7.38/13 19s} dxe3 {-1.90/7 14s}
28. Rxd8+ {+8.62/13 19s} Rxd8 {-2.20/7 13s} 29. fxe3 {+8.62/12 19s}
Rd2 {-3.10/7 9.4s} 30. Bxf7+ {+8.68/12 18s} Kg7 {-2.70/6 12s}
31. Nf4 {+9.01/13 18s} Rb2 {-2.75/7 12s} 32. h6+ {+9.71/13 18s}
Kf6 {-3.00/6 11s} 33. Qc4 {+9.88/14 17s} Kg5 {-3.25/6 11s}
34. Bg8 {+9.54/13 17s} Nxe3 {-3.00/7 10s} 35. Qc1 {+8.42/14 17s}
Qxf4 {-3.00/7 9.6s} 36. Rxf4 {+8.90/17 16s} Rxg2+ {-3.10/9 7.1s}
37. Kh1 {+9.40/17 16s} Kxf4 {-2.80/9 6.1s} 38. Qe1 {+9.40/15 16s}
Rxg8 {-2.25/8 8.8s} 39. Qf2+ {+10.67/15 15s} Ke5 {-2.25/8 8.5s}
40. Qxe3 {+10.82/16 15s} Rg6 {-2.50/8 6.8s} 41. Qc3+ {+10.96/15 15s}
Kd5 {-2.50/7 6.8s} 42. Qg7 {+19.74/17 14s} Rc6 {-2.75/8 7.7s}
43. Qxh7 {+21.26/14 14s} Kxc5 {-2.75/7 4.9s} 44. Qg7 {+23.58/16 14s}
Rxh6+ {-6.30/7 4.9s} 45. Qxh6 {+24.52/18 13s} b5 {-6.70/7 4.8s}
46. Qxa6 {+26.88/21 13s} c6 {-7.60/8 4.7s} 47. Qa7+ {+27.04/20 13s}
Kc4 {-7.60/6 4.6s} 48. Qb7 {+27.27/20 12s} Kc5 {-7.90/8 4.6s}
49. Qe7+ {+25.66/18 12s} Kd5 {-7.90/6 4.5s} 50. Qd7+ {+27.28/22 12s}
Kc5 {-8.10/6 4.5s} 51. Qe6 {+28.53/22 12s} Kb6 {-8.10/7 4.4s}
52. Qxe4 {+30.09/23 11s} Kc5 {-8.75/7 4.3s} 53. Qe5+ {+27.77/22 11s}
Kc4 {-8.75/6 4.3s} 54. Kg2 {+27.93/22 11s} c5 {-8.75/7 4.2s}
55. Qe2+ {+28.02/19 11s} Kc3 {-9.10/7 4.2s} 56. Qxb5 {+53.91/21 10s}
c4 {-9.50/7 4.1s} 57. a4 {+M19/19 10s} Kd4 {-9.50/7 4.1s} 58. a5 {+M17/18 9.8s}
c3 {-10.00/8 4.0s} 59. a6 {+M15/17 9.6s} Ke3 {-16.90/7 4.0s}
60. a7 {+M9/16 9.3s} Kd2 {-M8/7 4.0s} 61. a8=Q {+M7/15 9.1s}
Kc1 {-M6/6 3.9s, White makes an illegal move: a7a8Q} 0-1
[Event "?"]
[Site "?"]
[Date "2024.04.14"]
[Round "?"]
[White "Kojiro v0.1"]
[Black "Athene v0.1"]
[Result "0-1"]
[FEN "rnbqkb1r/ppp2ppp/5n2/3pp3/8/3PP3/PPPNNPPP/R1BQKB1R b KQkq - 3 4"]
[PlyCount "95"]
[SetUp "1"]
[Termination "illegal move"]
[TimeControl "900+3"]

1... Bg4 {+0.40/6 33s} 2. c4 {-0.57/12 21s} Nc6 {+0.35/6 32s}
3. cxd5 {-0.38/12 21s} Nxd5 {+0.45/6 31s} 4. a3 {-0.15/12 22s} Bd6 {+0.50/6 30s}
5. h3 {-0.02/12 22s} Be6 {+0.40/6 29s} 6. Ng3 {+0.07/12 22s} f5 {+0.70/6 28s}
7. e4 {+0.11/12 22s} fxe4 {+0.55/6 28s} 8. dxe4 {+0.11/11 23s} Nf4 {+0.55/6 27s}
9. Nf3 {-0.07/10 23s} Qf6 {+0.60/5 26s} 10. Qc2 {-0.29/11 23s}
Nxh3 {+0.50/5 25s} 11. Ba6 {-0.17/11 23s} Nb4 {+1.10/6 24s}
12. axb4 {+0.77/13 23s} bxa6 {+0.50/6 24s} 13. Rxh3 {+0.76/12 23s}
Bxh3 {+1.10/6 23s} 14. Bg5 {+1.30/13 23s} Bxb4+ {+1.10/7 22s}
15. Ke2 {+1.31/12 22s} Qb6 {+1.10/6 22s} 16. gxh3 {+1.42/13 22s}
Qb5+ {+1.00/6 21s} 17. Qd3 {+1.44/13 22s} Bd6 {+0.90/7 20s}
18. Qxb5+ {+2.08/14 22s} axb5 {+0.10/7 20s} 19. Nf5 {+1.99/14 22s}
g6 {+0.70/6 19s} 20. Nxd6+ {+3.92/16 21s} cxd6 {-0.15/7 19s}
21. Rd1 {+4.01/16 21s} Kd7 {-0.40/7 18s} 22. Nxe5+ {+4.49/15 21s}
Ke6 {-0.40/7 18s} 23. Nf3 {+4.51/14 21s} a6 {-0.50/7 17s} 24. Rd5 {+4.92/13 20s}
Rab8 {-0.60/7 17s} 25. Bf4 {+5.81/15 20s} Rb6 {-1.45/7 16s}
26. Ng5+ {+5.99/14 20s} Kd7 {-2.45/7 16s} 27. Bxd6 {+6.13/16 19s}
Kc8 {-2.40/7 15s} 28. Be5 {+6.51/14 19s} Re8 {-2.45/7 15s}
29. Nf7 {+7.18/16 19s} Kb7 {-2.40/7 15s} 30. Nd6+ {+7.13/16 18s}
Rxd6 {-2.35/9 14s} 31. Bxd6 {+7.31/17 18s} Rxe4+ {-2.35/7 14s}
32. Kf3 {+7.18/15 18s} Rh4 {-2.40/8 14s} 33. Kg3 {+7.44/16 17s}
Kc6 {-2.45/8 13s} 34. Kxh4 {+8.71/19 17s} Kxd5 {-2.45/9 13s}
35. Bf8 {+9.42/21 17s} Ke4 {-2.50/9 12s} 36. Kg5 {+9.73/23 16s}
Kf3 {-3.30/9 12s} 37. Bc5 {+10.11/22 16s} Kg2 {-3.40/9 12s}
38. h4 {+10.60/24 16s} Kh3 {-3.40/9 12s} 39. b4 {+13.01/22 15s}
Kh2 {-3.40/9 11s} 40. Kh6 {+14.71/23 15s} Kh3 {-3.40/10 11s}
41. Be7 {+29.92/24 15s} Kg4 {-3.50/10 11s} 42. Kxh7 {+30.20/23 14s}
Kf3 {-3.50/9 10s} 43. Kxg6 {+40.13/24 14s} Kf4 {-9.95/9 10s}
44. h5 {+41.03/23 14s} Ke5 {-12.30/9 10.0s} 45. h6 {+41.60/22 13s}
Ke6 {-13.40/9 9.8s} 46. Bc5 {+41.64/20 13s} a5 {-14.35/9 9.5s}
47. h7 {+M15/19 13s} axb4 {-14.35/8 9.3s} 48. h8=Q {+M11/18 12s}
Kd7 {-14.40/7 9.1s, White makes an illegal move: h7h8Q} 0-1
@tissatussa
Copy link
Author

did you consider to look into this Issue ?

@Babak-SSH
Copy link
Owner

Babak-SSH commented Aug 14, 2024

I checked the positions first in the Terminal to verify the output and then proceeded to try the positions in Arena Chess which is the usual GUI I use and promoted the queen with no problem in those two positions, furthermore, I tried the positions in lichess and played with Kojiro to verify there is no problem in the output of the UCI.

Having said that there's clearly a problem with my promotion move output and the CuteChess GUI, so I did a little bit of digging and found this issue thread which furthermore strengthens my suspicion that CuteChess GUI doesn't accept upper case for promotions.

these two promotion moves are upper cases because I use upper cases for white and lower cases for black, which isn't against UCI protocol afaik, and is kind of an aesthetic decision that follows the pattern of FEN format. I might think about removing it in other versions.

for now, if you want to try the bot with CuteChess GUI I guess replacing uppercase letters in promoted_pieces array with lowercase ones will solve the problem, it will only affect PV and bestmove output in UCI.

@tissatussa btw thanks for trying out my bot :)

@tissatussa
Copy link
Author

..replacing uppercase letters in promoted_pieces array with lowercase ones will solve the problem..

indeed, that's it !
this way i compiled successfully and the binary plays valid games in CuteChess GUI, also with promotions !

you should update the source code accordingly and create v0.1.1 ?

@tissatussa
Copy link
Author

btw. when compiling, i didn't get any errors, but lots of warnings !? i guess they're easy to fix - and you should ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants