Mergener / lunachess

A UCI chess engine.
MIT License
9 stars 0 forks source link

Illegal moves a1a1 in current 0.2.0 version #4

Closed rwbc closed 2 years ago

rwbc commented 2 years ago

Hello Thomas,

I found another issue with current Luna. In a first 60 games test match at 2+1 with my own 6plies start pgn under the CutechessGUI it occurred 11 times that it was forfeited due to an illegal move a1a1. (BTW I also want to note that there was no timeloss at all!)

Here are three examples (no debug/log files available):

[Event "My Tournament"]
[Site "RWBC-CAPPUCCINO Win7U64 Q8200 2.33Ghz"]
[Date "2022.10.08"]
[Round "8.1.2"]
[White "Pigeon_151fix-64"]
[Black "Luna_020-64"]
[Result "1-0"]
[ECO "A34"]
[GameDuration "00:00:19"]
[GameEndTime "2022-10-08T14:59:45.928 Mitteleuropäische Sommerzeit"]
[GameStartTime "2022-10-08T14:59:26.494 Mitteleuropäische Sommerzeit"]
[Opening "English"]
[PlyCount "11"]
[Termination "illegal move"]
[TimeControl "120+1"]
[Variation "Symmetrical variation"]

1. c4 {book} c5 {book}
2. Nc3 {book} g6 {book}
3. g3 {book} Bg7 {book}
4. Nf3 {+0.25/8 3.97} d6 {-0.12/8 2.72}
5. d4 {+0.46/7 2.59} Nc6 {-0.13/8 5.11}
6. d5 {+0.52/7 1.85}
{Black makes an illegal move: a1a1}
1-0

[Event "My Tournament"]
[Site "RWBC-CAPPUCCINO Win7U64 Q8200 2.33Ghz"]
[Date "2022.10.08"]
[Round "12.1.2"]
[White "Pigeon_151fix-64"]
[Black "Luna_020-64"]
[Result "1-0"]
[ECO "A00"]
[GameDuration "00:01:10"]
[GameEndTime "2022-10-08T15:33:14.557 Mitteleuropäische Sommerzeit"]
[GameStartTime "2022-10-08T15:32:04.394 Mitteleuropäische Sommerzeit"]
[Opening "Benko's Opening"]
[PlyCount "25"]
[Termination "illegal move"]
[TimeControl "120+1"]

1. g3 {book} c5 {book}
2. e4 {book} b6 {book}
3. Bg2 {book} Bb7 {book}
4. d3 {+0.27/7 1.43} d5 {-0.47/8 2.78}
5. e5 {+0.10/6 0.87} Nc6 {-0.34/8 3.69}
6. Bf4 {+0.22/7 3.28} g5 {+0.05/8 3.12}
7. Bxg5 {+0.14/8 4.93} Nxe5 {-0.15/8 3.44}
8. d4 {+0.32/7 3.60} cxd4 {+0.51/8 3.07}
9. Qxd4 {+0.04/7 3.08} Bg7 {+0.39/8 3.48}
10. Kf1 {-0.13/7 5.25} Qd7 {+0.54/7 6.28}
11. Nc3 {+0.41/6 6.26} f6 {+0.43/6 1.92}
12. Be3 {+0.40/6 1.73} Rd8 {+0.56/7 5.78}
13. Rd1 {+0.46/7 3.95}
{Black makes an illegal move: a1a1}
1-0

[Event "My Tournament"]
[Site "RWBC-CAPPUCCINO Win7U64 Q8200 2.33Ghz"]
[Date "2022.10.08"]
[Round "13.1.1"]
[White "Luna_020-64"]
[Black "Pigeon_151fix-64"]
[Result "0-1"]
[ECO "D00"]
[GameDuration "00:02:46"]
[GameEndTime "2022-10-08T15:36:01.778 Mitteleuropäische Sommerzeit"]
[GameStartTime "2022-10-08T15:33:15.588 Mitteleuropäische Sommerzeit"]
[Opening "Levitsky attack (Queen's Bishop attack)"]
[PlyCount "64"]
[Termination "illegal move"]
[TimeControl "120+1"]

1. d4 {book} d5 {book}
2. Bg5 {book} c5 {book}
3. dxc5 {book} Nf6 {book}
4. b4 {+0.63/7 4.64} Nc6 {-0.29/7 7.05}
5. c3 {+0.41/8 3.71} h6 {-0.44/7 2.42}
6. Bxf6 {+0.66/9 4.00} exf6 {-0.50/7 1.49}
7. Nd2 {+0.65/8 3.81} a5 {-0.11/7 3.56}
8. a3 {+0.79/7 3.86} d4 {-0.03/7 6.52}
9. cxd4 {+0.95/8 2.54} axb4 {-0.03/7 1.37}
10. axb4 {+0.86/9 3.92} Rxa1 {-0.24/8 2.85}
11. Qxa1 {+0.75/10 5.99} Qxd4 {-0.35/8 3.94}
12. Qxd4 {+0.74/9 2.20} Nxd4 {-0.32/9 2.19}
13. Kd1 {+0.63/10 2.32} Bd7 {-0.54/8 1.50}
14. e3 {+0.55/9 3.36} Nc6 {-0.35/8 1.36}
15. b5 {+0.94/9 2.41} Na7 {-0.37/8 1.56}
16. Ngf3 {-0.06/7 1.81} Bxc5 {+0.15/9 2.65}
17. Nb3 {+0.06/9 4.04} Bb4 {+0.02/8 1.88}
18. Nfd4 {-0.10/8 2.03} O-O {+0.33/8 2.71}
19. Bd3 {-0.05/7 2.15} b6 {+0.48/7 1.12}
20. Ke2 {+0.16/7 2.31} Rc8 {+0.20/7 2.63}
21. Ra1 {+0.18/8 2.54} Rc7 {-0.28/8 2.33}
22. Kf1 {+0.20/8 2.50} Bc8 {+0.18/7 1.28}
23. Kg1 {+0.25/8 4.71} Rc3 {+0.24/7 1.18}
24. Be2 {+0.33/8 2.83} Rc7 {+0.16/7 1.03}
25. e4 {+0.36/8 3.99} g6 {+0.26/7 1.81}
26. h4 {+0.37/7 1.94} Kf8 {+0.27/7 2.75}
27. g4 {+0.41/8 3.85} Bd6 {+0.21/8 3.63}
28. h5 {+0.42/6 1.50} Be5 {+0.43/7 1.14}
29. Ra4 {+0.46/7 2.13} Bf4 {+0.22/8 3.36}
30. f3 {+0.44/7 2.29} Be3+ {+0.03/8 3.10}
31. Kh1 {+0.50/6 1.67} Kg7 {+0.01/8 3.04}
32. Bf1 {+0.50/7 2.86} gxh5 {+0.15/7 4.86}
{White makes an illegal move: a1a1}
0-1

You can download a 7z file from my site with all games here: rwbc-chess.de/Downloads/Debug/luna_020.7z

##################################################

BTW there is another very minor cosmetical 'issue', which happens with some other programs too , but it would not prevent me listing it in my chronology. I think it doesn't deserve another full issue here, thus I will describe it shortly under this issue.

In the very end of the game before being mated, the eval suddenly appears as 0.00 at least in the written pgn. May be it just sends the depth at that point and the GUI sets it to zero? If that was true and too much code would needed to be changed a simple solution would be just sending the previous eval (just a proposal).

Like I said, this is just cosmetical, but e.g. me (and others) use sometimes tools/scripts, which compare evals, or print graphs from pgn data and the discontinuity gives a bit ugly results then.

Examples:

[Event "My Tournament"]
[Site "RWBC-CAPPUCCINO Win7U64 Q8200 2.33Ghz"]
[Date "2022.10.08"]
[Round "12.1.1"]
[White "Luna_020-64"]
[Black "Pigeon_151fix-64"]
[Result "0-1"]
[ECO "A00"]
[GameDuration "00:05:52"]
[GameEndTime "2022-10-08T15:32:03.362 Mitteleuropäische Sommerzeit"]
[GameStartTime "2022-10-08T15:26:11.156 Mitteleuropäische Sommerzeit"]
[Opening "Benko's Opening"]
[PlyCount "160"]
[TimeControl "120+1"]

1. g3 {book} c5 {book}
2. e4 {book} b6 {book}
3. Bg2 {book} Bb7 {book}
...
78. Kg3 {-19.00/6 2.99} b1=Q {+325.11/9 0.95}
79. Kh3 {-19.08/6 2.08} Qg6 {+325.11/7 0.60}
80. Kh4 {0.00/9 1.34} Rh7# {+325.11/7 0.63}
{Black mates}
0-1

[Event "My Tournament"]
[Site "RWBC-CAPPUCCINO Win7U64 Q8200 2.33Ghz"]
[Date "2022.10.08"]
[Round "13.1.2"]
[White "Pigeon_151fix-64"]
[Black "Luna_020-64"]
[Result "1-0"]
[ECO "D00"]
[GameDuration "00:05:29"]
[GameEndTime "2022-10-08T15:41:32.274 Mitteleuropäische Sommerzeit"]
[GameStartTime "2022-10-08T15:36:02.794 Mitteleuropäische Sommerzeit"]
[Opening "Levitsky attack (Queen's Bishop attack)"]
[PlyCount "145"]
[TimeControl "120+1"]

1. d4 {book} d5 {book}
2. Bg5 {book} c5 {book}
3. dxc5 {book} Nf6 {book}
...
69. Qe4+ {+325.11/7 0.51} Kf2 {-M2/9 2.45}
70. Bh3 {+325.11/8 2.96} Kg1 {0.00/10 1.40}
71. Kxh5 {+325.11/8 2.87} Kf2 {-M2/8 2.57}
72. Kh4 {+325.11/7 0.48} Kg1 {0.00/10 1.59}
73. Qg2# {+325.11/7 0.40}
{White mates}
1-0

Cheers, Guenther

Mergener commented 2 years ago

Hi Guenther,

Both issues seem to be related with the way the engine is handling time, although I'm not 100% sure. Anyway, I just pushed a change that prevents the engine from outputting a1a1 (MOVE_INVALID) in any scenario. I tested the changes in 128 2min+1sec and 2sec+0.15sec games (64 for each time control) against multiple engines and all games turned out fine.

Once again, thank you for your contribution :)

Thomas

rwbc commented 2 years ago

Hi Thomas,

Sorry for the late reply, but finally I had compiled it again and this time in release mode too. I had no time yet for doing a retest myself, but I am pretty sure you fixed this issue ;-)

Today I added Luna to the XB/UCI chronology and provided a link to my compilation. Feel free to correct any wrong info on my side, or create a binary release yourself.

Good luck with Luna and best wishes from Germany/Regensburg, Guenther