likeawizard / tofiks

UCI chess engine written in Go
GNU General Public License v3.0
19 stars 0 forks source link

Allowing draw by repetition in a won position #49

Closed SzotsGabor closed 1 year ago

SzotsGabor commented 1 year ago

Here is a game from my tournament:

[Event "Tofiks 1.2.0 64-bit - Sep 30"]
[Site "Szentendre"]
[Date "2023.09.30"]
[Round "1"]
[White "Tofiks 1.2.0 64-bit"]
[Black "Rustic Alpha 3.0.0 64-bit"]
[Result "1/2-1/2"]
[ECO "A30"]
[Opening "English"]
[Time "15:15:09"]
[Variation "Symmetrical, Hedgehog System, 8.Qxd4 d6"]
[TimeControl "85+1"]
[PlyCount "122"]

1. Nf3 Nf6 2. c4 e6 3. g3 b6 4. Bg2 Bb7 5. O-O Be7 6. Nc3 c5 7. d4 cxd4 8.
Qxd4 d6 9. e4 {+0.11/8 3} O-O {0.00/8 2} 10. a4 {+0.07/8 3} Na6 {+0.15/8 3}
11. e5 {-0.36/8 3} dxe5 {+0.35/9 3} 12. Qxd8 {-0.12/10 3} Raxd8 {+0.45/9 3}
13. Nxe5 {-0.23/9 3} Bxg2 {+0.40/9 3} 14. Kxg2 {-0.18/10 3} Bd6 {+0.33/8 3}
15. Nf3 {+0.16/10 3} e5 {+0.45/8 3} 16. Bg5 {+0.59/9 3} Nc5 {+0.35/9 2} 17.
Bxf6 {+0.54/9 3} gxf6 {+0.30/9 3} 18. Nd5 {+0.33/8 3} f5 {+0.25/9 3} 19.
Nh4 {+0.33/8 3} Nd3 {+0.10/9 4} 20. Rab1 {+0.70/10 3} f4 {-0.10/9 4} 21.
Rfd1 {+0.58/10 3} Nb4 {0.00/9 4} 22. Nf6+ {+0.74/11 3} Kg7 {0.00/9 4} 23.
Ne4 {+0.74/11 3} Bc5 {0.00/10 4} 24. gxf4 {+1.01/10 3} exf4 {+0.05/9 5} 25.
Nxc5 {+0.81/10 3} bxc5 {0.00/10 4} 26. Nf5+ {+0.92/10 3} Kg6 {+0.10/8 0}
27. Nd6 {+1.14/10 3} Nc6 {+0.05/8 1} 28. b3 {+1.32/9 3} Rb8 {-0.45/8 1} 29.
Rd5 {+1.24/9 3} Nd4 {-0.70/8 1} 30. Nb5 {+1.53/10 3} Ne6 {-0.85/8 1} 31.
Nxa7 {+1.93/10 3} Rb6 {-0.85/8 1} 32. Nb5 {+2.03/9 3} Kg7 {-0.90/8 1} 33.
Rbd1 {+2.06/8 3} Kg8 {-0.90/8 1} 34. h4 {+2.11/9 2} Rb7 {-0.95/8 1} 35. Rd7
{+2.15/9 2} Rxd7 {-0.90/9 1} 36. Rxd7 {+2.10/11 2} Ra8 {-1.00/9 1} 37. Rb7
{+2.13/11 2} Rd8 {-0.95/9 1} 38. Nc3 {+2.14/11 2} f3+ {-1.00/9 1} 39. Kg3
{+2.15/10 2} Rd3 {-1.20/10 1} 40. Ne4 {+2.67/11 2} Kg7 {-1.35/10 1} 41. a5
{+2.93/10 2} Nd8 {-2.20/9 2} 42. Rb8 {+3.09/11 1} Ne6 {-2.55/10 1} 43. a6
{+3.00/11 1} Rd7 {-2.60/10 2} 44. Rb7 {+3.26/11 1} Rd1 {-2.70/10 2} 45. a7
{+3.52/10 1} Ra1 {-2.85/9 2} 46. Nc3 {+4.10/9 1} Ra5 {-3.55/9 2} 47. Na4
{+4.45/10 1} Nd4 {-3.85/11 2} 48. Nb6 {+4.85/11 1} Nxb3 {-4.45/10 2} 49.
a8=Q {+5.48/13 1} Rxa8 {-4.65/11 2} 50. Nxa8 {+5.53/14 1} Na5 {-4.85/12 3}
51. Rc7 {+5.66/15 1} Nxc4 {-4.93/11 0} 52. Kxf3 {+5.52/11 1} Nd2+ {-4.85/9
0} 53. Ke3 {+5.69/11 1} Nc4+ {-5.00/10 0} 54. Kf4 {+5.74/12 1} Nb2
{-5.05/10 0} 55. Rc6 {+5.61/11 1} Na4 {-4.95/9 0} 56. Nb6 {+5.79/15 1} Nb2
{-5.15/10 0} 57. Ke3 {+5.79/11 1} Nd1+ {-5.35/10 0} 58. Ke2 {+5.92/12 1}
Nc3+ {-5.20/10 0} 59. Ke3 {+5.82/12 1} Nd1+ {0.00/13 0} 60. Kf4 {+4.79/10
1} Nb2 {0.00/13 0} 61. Ke3 {+5.78/12 1} Nd1+ {0.00/14 0 3-fold repetition}
1/2-1/2

Tofiks uses time rather aggressively, maybe that was the reason.

likeawizard commented 1 year ago

@SzotsGabor thank you for your feed back.

Both on the draw and also on the time management.

I recently have seen some 3-fold repetition draws, while it should have draw by repetition detection I wonder if it works a bit strange. Probably something I should add in my test suite. I think I saw more repetitions recently after adding some new features. Yea, needs investigation if it did not see it or if it thought it was the best move. From the PGN it actually seems like Tofiks was thinking it was winning until the three-fold game termination. So that suggests there is something wrong.

As for time management - again I have not spent a lot of work on time management since I first implemented it and most of it was for online play to properly handle lag. I have some ideas in time management and hopefully I can implement them soon and revisit that aspect.

SzotsGabor commented 1 year ago

Here is another one:

[Event "Tofiks 1.2.0 64-bit - Sep 30"]
[Site "Szentendre"]
[Date "2023.09.30"]
[Round "4"]
[White "Purple Haze 2.1.0"]
[Black "Tofiks 1.2.0 64-bit"]
[Result "1/2-1/2"]
[ECO "B17"]
[Opening "Caro-Kann"]
[Time "17:59:07"]
[Variation "Steinitz, 5.Nf3 Ngf6 6.Nxf6+ Nxf6 7.Bc4"]
[TimeControl "85+1"]
[PlyCount "83"]

1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nd7 5. Nf3 Ngf6 6. Nxf6+ Nxf6 7. Bc4
{+0.61/10 1} e6 {-0.63/8 3} 8. O-O {+0.60/11 1} b5 {-0.55/9 3} 9. Be2
{+0.92/12 1} Bb7 {-0.48/9 3} 10. c3 {+0.82/11 1} Bd6 {-0.40/8 3} 11. Bg5
{+0.89/12 1} O-O {+0.02/8 3} 12. Bd3 {+0.89/11 1} a6 {+0.07/6 3} 13. Qc2
{+1.23/10 1} h6 {+0.07/8 3} 14. Bc1 {+1.13/11 1} Qc7 {0.00/8 3} 15. g3
{+0.86/10 1} c5 {+0.74/9 3} 16. Qd1 {+0.76/11 1} Qc6 {+0.76/8 3} 17. Be2
{+0.68/12 1} e5 {+0.75/8 3} 18. dxe5 {+0.70/11 1} Bxe5 {+0.92/9 3} 19. Re1
{+0.61/10 1} Bc7 {+1.02/8 3} 20. Bf4 {+0.17/10 1} Bxf4 {+3.17/10 3} 21.
gxf4 {-1.69/11 1} Nh5 {+3.18/10 3} 22. Qd2 {-1.74/11 1} Rad8 {+3.96/10 3}
23. Qc1 {-4.70/12 1} Rde8 {+4.23/9 3} 24. Qd2 {-2.74/13 1} Rxe2 {+4.24/10
3} 25. Qxe2 {-3.58/14 2} Nxf4 {+5.11/11 3} 26. Qe3 {-3.58/14 2} Qg6+
{+4.95/11 3} 27. Ng5 {-3.63/15 2} Qxg5+ {+4.98/12 3} 28. Qg3 {-3.66/16 2}
Qf6 {+4.47/9 3} 29. Kf1 {-2.75/12 2} Bg2+ {+4.47/8 3} 30. Kg1 {-2.79/14 2}
Rd8 {+4.28/9 3} 31. Re3 {-2.81/12 2} Rd2 {+5.00/9 3} 32. b3 {-3.17/12 2} h5
{+5.18/8 3} 33. Rae1 {-3.57/13 2} Bd5 {+5.91/9 2} 34. Kf1 {-4.34/12 2} Rxa2
{+6.26/9 2} 35. Re8+ {-4.34/11 2} Kh7 {+7.08/8 2} 36. Qe3 {-5.28/12 2} Bg2+
{+7.97/9 2} 37. Kg1 {-6.18/13 2} c4 {+6.06/8 2} 38. bxc4 {-4.78/10 2} Bc6
{+8.37/8 2} 39. Kf1 {-6.27/12 2} Bg2+ {+8.37/9 2} 40. Kg1 {0.00/128 0} Bc6
{+8.37/9 2} 41. Kf1 {0.00/16 2} Bg2+ {+8.37/10 1} 42. Kg1 {0.00/128 0
3-fold repetition} 1/2-1/2

I like the time management as it is, Tofiks spends its time on the initial phases of the game and reaches good positions.