alvinypeng / d-house

UCI chess engine coded in pure Python with no external libraries
GNU General Public License v3.0
4 stars 0 forks source link

D-House plays well, but not the end game #1

Open tissatussa opened 1 year ago

tissatussa commented 1 year ago

congrats with this engine, i'm impressed !

i managed to run D-House v1.2.0 by python3 ./main.py and it runs in CuteChess (GUI), but not flawlessly : it suddenly disconnects .. however, a binary compiled by pyinstaller runs fine, without disconnection ever ..

this way i let D-House play several games in CuteChess against other engines .. it seems D-House plays very well in the opening and middle game, doing 'human-like' moves (i like its style!) and even competing with several strong (2700+) engines, like 4KU v3.0 and Pawn v1.0 NN .. however, in many of those games (5 minutes and also 15 minutes) D-House suddenly loses track in the end game, plays a bad move, and then is lost ..

i see the NPS info : D-House does not reach many Nodes Per Second, i estimate it does 400 times less NPS than many other (C++) engines, and it does not reach a high depth .. but i guess this is not a real issue, as long as the eval function and pruning is good - am i right ? btw. i set onlineSyZyGy OFF

one example position where D-House v1.2.0 went wrong :

D-House eval : d-house-eval

ShashChess GZ NNUE eval (Multi-PV 7) :

shashchess-GZ-NNUE-eval

it was a game with TimeControl 300+3 .. it happened at move 29 : D-House spent 6.5 seconds to decide best move is Neg3, which is not the right way : i let ShashChess GZ NNUE evaluate and it shows the moves Qd3 and Qe3 are best .. D-House also sees these best moves, but only after 11.81 seconds (tested in SCID, see screenshots).

i guess D-House needs improving in the end game : when few pieces are on the board, D-House often seems to overlook rather simple tactics, eg. the opponent temporarily sacrifices a piece to get it back a few moves later.


here's the game .. Princhess v0.11.0 has rating about 2400 and for a long time D-House does a great battle :

[Event "engine vs engine"]
[Site "Holland @ https://lichess.org/dYd6BAsb#56 "]
[Date "2023.05.18"]
[Round "?"]
[White "D-House v1.2.0"]
[Black "Princhess v0.11.0"]
[Result "0-1"]
[ECO "E71"]
[GameDuration "00:16:08"]
[Opening "King's Indian"]
[PlyCount "144"]
[TimeControl "300+3"]
[Variation "Makagonov system (5.h3)"]

1. d4 {+0.23/13 15s} Nf6 {-0.12/9 18s} 2. c4 {+0.14/13 9.7s} g6 {-0.11/12 17s} 3. Nc3 {+0.45/12 11s} Bg7 {-0.11/12 17s} 4. e4 {+0.62/13 12s} d6 {-0.13/12 16s} 5. h3 {+0.46/12 11s} O-O {-0.13/13 15s} 6. Nf3 {+0.51/12 8.7s} e5 {-0.12/18 15s} 7. d5 {+0.45/11 8.5s} Na6 {+0.02/17 14s} 8. Bd3 {+0.51/13 10s} Nh5 {+0.05/15 14s} 9. O-O {+0.49/13 8.1s} Nc5 {+0.05/17 13s} 10. Bc2 {+0.45/13 11s} a5 {+0.05/18 13s} 11. Be3 {+0.54/12 10.0s} Nf4 {+0.01/9 12s} 12. a3 {+0.51/12 8.7s} Bh6 {-0.07/13 12s} 13. b4 {+0.82/10 9.0s} Nd7 {-0.18/13 11s} 14. c5 {+0.65/10 9.0s} Qe7 {-0.23/20 11s} 15. Ba4 {+0.60/10 7.9s} f5 {-0.05/18 10s} 16. Bxd7 {+0.42/8 10.0s} Bxd7 {-0.04/19 10s} 17. Re1 {+0.40/10 7.5s} Qg7 {-0.01/19 9.7s} 18. b5 {+0.79/10 7.7s} b6 {-0.06/17 9.3s} 19. c6 {+0.30/11 8.8s} Bc8 {-0.04/23 9.0s} 20. Rc1 {+0.06/12 4.3s} Kh8 {+0.01/17 8.7s} 21. Ra1 {-0.13/11 6.9s} g5 {+0.05/14 8.4s} 22. Nh2 {-0.32/12 9.2s} Rg8 {+0.38/15 8.2s} 23. a4 {-0.04/13 7.5s} g4 {+0.47/20 7.9s} 24. hxg4 {+0.33/14 8.4s} fxg4 {+0.47/38 7.7s} 25. Nf1 {+0.28/12 5.4s} Qf6 {+0.45/14 7.4s} 26. Ne2 {+0.40/12 7.9s} Nh5 {+0.18/13 7.2s} 27. Bxh6 {+0.67/12 6.5s} Qxh6 {+0.21/16 7.0s} 28. Qd2 {+0.70/12 7.1s} Qg6 {+0.21/14 6.8s} 29. Neg3 {+0.29/12 6.5s} Nf6 {+0.28/14 6.6s} 30. Qd1 {-0.55/11 6.6s} h5 {+0.77/20 6.4s} 31. Ne3 {-0.95/13 7.1s} h4 {+0.80/19 6.3s} 32. Ngf5 {-0.47/13 7.8s} Qh7 {+0.79/15 6.1s} 33. f3 {-0.63/12 9.2s} Bxf5 {+0.64/20 5.9s} 34. Nxf5 {-0.79/11 3.3s} Raf8 {+0.62/17 5.8s} 35. Rf1 {-1.08/12 12s} g3 {+0.97/18 5.6s} 36. Qd2 {-0.94/11 7.1s} Rg6 {+0.73/23 5.5s} 37. Rfd1 {-1.61/11 12s} Rfg8 {+2.33/16 5.4s} 38. Qe3 {-1.64/10 6.9s} h3 {+2.06/21 5.3s} 39. Kf1 {-3.16/10 3.8s} hxg2+ {+3.18/16 5.2s} 40. Ke2 {-3.10/11 2.9s} Rg5 {+3.30/18 5.1s} 41. Qd2 {-3.42/12 4.5s} Nh5 {+4.84/20 4.9s} 42. Kd3 {-3.48/12 5.4s} Nf4+ {+3.98/15 4.8s} 43. Kc3 {-2.98/11 3.7s} Rh5 {+3.78/13 4.8s} 44. Rg1 {-2.98/12 5.1s} Rh3 {+3.43/19 4.7s} 45. Rad1 {-2.99/11 3.6s} Qh5 {+4.03/14 4.6s} 46. Qe3 {-3.10/11 4.9s} Rg5 {+4.20/15 4.5s} 47. Kb2 {-3.01/10 4.0s} Kh7 {+3.83/15 4.4s} 48. Nxd6 {-0.98/11 2.9s} cxd6 {+1.89/24 4.4s} 49. c7 {-2.25/11 2.1s} Rg8 {+1.96/35 4.3s} 50. Qxb6 {-2.70/11 5.1s} Qxf3 {+2.25/40 4.2s} 51. Qxd6 {-3.24/11 5.5s} Rh1 {+2.54/43 4.2s} 52. Qe7+ {-2.67/11 4.4s} Rg7 {+1.60/24 4.1s} 53. Qxe5 {-1.56/11 3.6s} Ng6 {+3.89/24 4.1s} 54. Rxh1+ {-1.78/11 5.0s} gxh1=R {+0.90/23 4.0s} 55. Rxh1+ {-3.20/13 7.6s} Qxh1 {+0.92/26 3.9s} 56. Qxg3 {-2.85/13 2.8s} Ne7 {+0.93/24 3.9s} 57. Qc3 {-4.06/13 18s} Qg2+ {+4.58/19 3.9s} 58. Kc1 {-2.73/9 2.0s} Rf7 {+5.27/24 3.8s} 59. Qc2 {-9.72/13 7.5s} Rf2 {+8.90/17 3.8s} 60. Qd1 {-9.72/13 1.6s} Rf1 {+8.94/20 3.7s} 61. Qxf1 {-10.14/11 2.2s} Qxf1+ {+9.02/17 3.7s} 62. Kb2 {-14.00/13 1.3s} Nc8 {+9.11/16 3.7s} 63. e5 {-10.82/11 3.4s} Qf4 {+9.32/17 3.6s} 64. b6 {-11.49/9 2.5s} Qxe5+ {+9.57/16 3.6s} 65. Kc1 {-12.33/9 2.6s} Nxb6 {+9.70/15 3.6s} 66. c8=B {-217.26/12 2.5s} Nxc8 {+9.83/12 3.5s} 67. d6 {-217.77/12 1.3s} Qxd6 {+10.00/13 3.4s} 68. Kb1 {-218.37/12 2.2s} Qd2 {+10.00/8 3.3s} 69. Ka1 {-225.93/16 1.8s} Qb4 {+10.00/6 3.2s} 70. Ka2 {-225.99/13 1.6s} Nb6 {+10.00/4 3.1s} 71. Ka1 {-M4/60 1.0s} Nxa4 {+10.00/2 3.1s} 72. Ka2 {-M2/60 0.083s} Qb2# {3.1s, Black mates} 0-1
GyatsoYT commented 8 months ago

Well it even makes stockfish 11 run for its money till the middlegame it goes with equal position (checked through stockfish 16) but as python is not as fast it tends to lose a lot of time in the opening and middlegame and in the endgame plays a bad move and loses. What I probably think is that if we give infinite time to dhouse and a limited amount of time to stockfish11 (90min in this case) it should probably be doing great against some better chess engines but it's python and it's slow....