skycloudd / eccat

An experimental UCI chess engine written in Rust
MIT License
1 stars 1 forks source link

eccat v0.1.2 draws but it's +6 #3

Closed tissatussa closed 1 month ago

tissatussa commented 2 months ago

in one of the many games i let eccat v0.1.2 play (7m+3s) against other engines this happened :

position-eccat_v0 1 2_draw_but_it's_+6!

it did a move repetition and made a draw .. but according to SF 16 HCE this position is almost +6 (at depth 34) !?

34 +5.83 40.c4 Rg1 41.Bh3 Rg3 42.Bxe6 h3 43.Bd5 h2 44.Ra8 Rh3 45.c5 [...]

this shouldn't happen .. do you have an explanation ? btw. i'm not aware eccat v0.1.2 does this often.

tissatussa commented 2 months ago

a similar one :

position-eccat_v0 1 2_draw_but_it's_+7!

[Event "engine vs engine"] [Site "?"] [Date "2024.05.08"] [Round "?"] [White "Simple"] [Black "Eccat v0.1.2"] [Result "1/2-1/2"] [ECO "A00"] [Opening "Dunst (Sleipner, Heinrichsen) Opening"] [PlyCount "205"] [TimeControl "420+3"]

  1. Nc3 {+0.01/13 8.4s} d5 {-0.10/12 24s} 2. e3 {0.00/12 12s} e5 {+0.07/12 23s}
  2. Qh5 {+0.22/12 8.8s} Bd6 {+0.25/13 16s} 4. Nxd5 {+0.19/11 8.5s} Be6 {+0.12/12 21s} 5. e4 {+0.19/12 11s} c6 {+0.15/13 19s} 6. Ne3 {+0.26/12 8.4s} Nf6 {-0.04/12 19s} 7. Qh4 {+0.26/12 6.7s} Nbd7 {-0.04/11 19s}
  3. Nf5 {+0.22/12 13s} Bxf5 {+0.11/12 18s} 9. exf5 {+0.18/12 5.7s} O-O {+0.16/11 17s} 10. Ne2 {+0.28/12 11s} Qb6 {+0.13/11 17s}
  4. Nc3 {+0.23/12 7.3s} Qd4 {+0.07/12 16s} 12. Qg3 {+0.41/12 18s} e4 {+0.09/12 11s} 13. Qe3 {+0.29/12 6.6s} Qe5 {+0.09/12 15s}
  5. Qh3 {+0.24/12 6.4s} Bc5 {+0.19/11 14s} 15. Be2 {+0.57/12 9.8s} Rad8 {+0.12/11 8.8s} 16. O-O {+0.53/12 7.9s} Bd4 {+0.07/12 13s}
  6. Rb1 {+0.51/12 8.9s} Nb6 {+0.15/11 13s} 18. a3 {+0.39/10 6.1s} h6 {+0.14/10 12s} 19. Nd1 {+0.47/10 5.5s} Nbd5 {+0.04/11 8.2s}
  7. d3 {+0.44/11 10s} exd3 {+0.02/11 12s} 21. Bxd3 {+0.57/11 6.6s} Ne4 {-0.10/12 10s} 22. Qg4 {+0.58/10 6.1s} Ndf6 {-0.23/12 7.6s}
  8. Qf3 {+0.46/11 7.3s} Rfe8 {-0.08/10 11s} 24. Ra1 {+0.42/10 9.0s} a6 {+0.08/10 10s} 25. Be3 {+0.37/10 11s} Bxe3 {+0.31/12 9.9s}
  9. Qxe3 {0.00/11 4.6s} Qc7 {+0.29/12 7.3s} 27. Kh1 {0.00/11 6.6s} c5 {+0.43/11 9.3s} 28. Qc1 {0.00/12 8.1s} Ng4 {+0.53/12 6.6s}
  10. f4 {-0.19/13 7.4s} Qc6 {+0.75/12 8.8s} 30. a4 {-0.12/12 7.1s} c4 {+0.94/12 8.5s} 31. Bxe4 {-0.27/14 7.1s} Rxe4 {+0.90/12 7.7s}
  11. Nc3 {-0.32/14 7.3s} Re3 {+1.02/12 7.3s} 33. Kg1 {-0.79/13 10s} Ree8 {+1.09/12 5.1s} 34. Kh1 {-0.45/12 3.9s} Ne3 {+1.24/12 7.7s}
  12. Rf3 {-0.40/12 4.7s} Nxf5 {+1.33/12 7.5s} 36. a5 {-0.40/12 4.4s} b6 {+1.26/11 7.3s} 37. axb6 {-0.41/12 4.9s} Qxb6 {+1.18/12 6.6s}
  13. Rb1 {-0.47/12 6.8s} Qe6 {+1.06/10 6.9s} 39. Rf2 {-0.40/12 6.1s} Qd6 {+1.16/11 6.7s} 40. Kg1 {-0.45/12 4.7s} Ne3 {+1.23/12 5.0s}
  14. Re2 {-0.82/12 5.9s} Qxf4 {+1.62/11 4.5s} 42. Kh1 {-0.96/12 8.1s} Rd4 {+2.15/9 6.3s} 43. Qg1 {-0.65/12 5.9s} Rd6 {+1.20/12 6.1s}
  15. Nd1 {-0.73/11 4.9s} Rde6 {+1.32/13 6.0s} 45. Rf2 {-0.82/13 5.4s} Qc7 {+1.48/12 5.8s} 46. Nxe3 {-0.87/13 12s} Rxe3 {+1.47/12 3.9s}
  16. c3 {-0.91/13 4.3s} Qd6 {+1.49/10 5.7s} 48. Qf1 {-0.87/13 8.4s} Qe6 {+1.51/12 5.0s} 49. Kg1 {-0.86/13 5.3s} h5 {+1.46/11 5.3s}
  17. Kh1 {-0.90/11 3.5s} Rd8 {+1.57/10 5.3s} 51. Kg1 {-0.82/11 3.4s} Rdd3 {+1.60/12 4.4s} 52. Ra1 {-0.93/12 4.6s} h4 {+1.61/10 5.1s}
  18. h3 {-0.95/12 3.3s} a5 {+1.61/10 5.0s} 54. Rf4 {-0.94/11 2.9s} Rg3 {+1.71/11 4.9s} 55. Rf2 {-0.92/10 3.3s} Rge3 {+1.62/11 4.8s}
  19. Rf4 {0.00/15 4.1s} Qb6 {+1.62/10 3.1s} 57. Rf2 {-0.97/11 3.4s} Qc5 {+1.62/11 4.7s} 58. Kh1 {-0.96/12 4.9s} Qe7 {+1.62/11 3.3s}
  20. Kh2 {-0.95/12 15s} Qd6+ {+1.62/10 4.6s} 60. Kh1 {-0.96/12 3.1s} Qe6 {+1.62/11 4.5s} 61. Rb1 {-0.97/12 5.4s} a4 {+1.76/11 2.8s}
  21. Rc1 {-1.10/11 6.2s} Re4 {+1.81/10 4.5s} 63. Ra1 {-1.13/12 5.7s} a3 {+1.91/12 3.6s} 64. bxa3 {-1.15/12 5.0s} Rxc3 {+1.91/12 4.4s}
  22. a4 {-1.58/12 7.0s} Rce3 {+2.04/12 3.9s} 66. Qg1 {-1.67/13 4.5s} c3 {+2.13/12 4.3s} 67. a5 {-1.76/13 4.3s} Qc6 {+2.35/10 4.2s}
  23. Kh2 {-1.76/12 2.9s} c2 {+2.96/11 3.3s} 69. Rff1 {-2.89/11 4.9s} Re2 {+3.49/11 4.1s} 70. Rac1 {-3.08/11 2.5s} Qc7+ {+3.78/11 4.1s}
  24. Kh1 {-3.14/13 3.3s} Qxa5 {+3.92/12 4.0s} 72. Qh2 {-3.36/12 2.6s} Qd5 {+3.96/12 3.5s} 73. Rg1 {-4.21/12 4.6s} Rd4 {+4.54/12 3.9s}
  25. Qc7 {-5.36/12 2.6s} Rd1 {+5.62/13 2.6s} 75. Qc8+ {-5.33/14 3.5s} Kh7 {+5.99/13 3.9s} 76. Qxc2+ {-5.76/14 3.5s} Rxc2 {+6.45/12 3.9s}
  26. Rcxd1 {-5.89/15 3.1s} Qc4 {+6.46/13 2.5s} 78. Rdf1 {-5.74/13 6.5s} Rc3 {+6.46/13 3.8s} 79. Kh2 {-5.60/12 2.5s} Qc7+ {+6.54/13 3.8s}
  27. Kh1 {-5.74/16 2.8s} Qc6 {+6.54/14 2.7s} 81. Kh2 {-5.73/15 2.9s} Qd6+ {+6.54/14 2.5s} 82. Kh1 {-5.82/17 2.4s} Qd5 {+6.54/14 3.8s}
  28. Kh2 {-5.86/15 2.5s} Qe5+ {+6.54/13 3.8s} 84. Kh1 {-5.71/15 2.8s} Qd5 {+6.54/14 3.7s} 85. Kh2 {0.00/21 3.8s} Qe5+ {+6.54/14 3.7s}
  29. Kh1 {0.00/23 2.5s} Qe4 {+6.54/12 2.3s} 87. Kh2 {-5.70/14 2.7s} Kg6 {+6.51/12 2.5s} 88. Re1 {-5.54/13 3.5s} Qf4+ {+6.51/13 2.2s}
  30. Kh1 {-5.53/15 2.4s} Qc4 {+6.51/13 3.8s} 90. Kh2 {-5.58/12 2.3s} Qc7+ {+6.53/13 3.7s} 91. Kh1 {-5.71/15 3.8s} Qc6 {+6.53/14 2.4s}
  31. Kh2 {-5.70/15 4.7s} Qd6+ {+6.53/14 3.2s} 93. Kh1 {-5.69/16 4.8s} Qd5 {+6.53/14 3.7s} 94. Kh2 {-5.58/14 2.3s} Qd6+ {+6.53/13 3.7s}
  32. Kh1 {0.00/23 4.5s} Qd5 {+6.53/14 3.6s} 96. Kh2 {0.00/20 3.4s} Rd3 {+6.55/10 2.6s} 97. Ref1 {-5.68/13 4.4s} Qe5+ {+6.56/12 3.6s}
  33. Kh1 {-5.69/16 4.3s} Qd4 {+6.55/11 2.2s} 99. Kh2 {-5.67/14 5.8s} Qd6+ {+6.56/12 2.8s} 100. Kh1 {-5.79/16 4.3s} Qd5 {+6.56/14 3.6s}
  34. Kh2 {0.00/20 4.3s} Qc5 {+6.56/12 3.6s} 102. Kh1 {-5.66/14 3.3s} Qd5 {+6.56/13 3.6s} 103. Kh2 {0.00/20 3.6s, Draw by 3-fold repetition} 1/2-1/2
skycloudd commented 2 months ago

Haven't tested this yet, but I have a feeling this is a bug related to the transposition table.

It probably stored a high evaluation from a previous search when there wasn't a risk of a 3-fold repetition yet, never updated the entry, and then didn't realise that it was now actually 0.00 because of the repetition.

This should be fixed by clearing the tt between searches, with the cost of decreasing the depth reached in searches (especially on fast time controls). I think that's worth it to fix bugs like this though.

skycloudd commented 2 months ago

@tissatussa would you mind testing that branch? it should completely stop things like this from happening, and possibly also fixes other hidden bugs

tissatussa commented 2 months ago

yes, i saw your https://github.com/skycloudd/eccat/pull/4

i think you have the right approach ! now and then i'm still letting eccat v0.1.2 play against engines of similar strength, just to see its style and performance, but also to find weird things happening like these ! Sure i will test a newer version, but by chance we encounter such 3-fold repetitions etc .. i hope my example positions can help you deduce a problem - i guess you just did.