I am sure someone else did it already but I still feel very proud. I have been coding and playing chess from my childhood and dreamed of writing a program that could play chess for my entire life. I have started and stopped this project so many times that I was about to abandon the idea forever.
During one of the COVID lockdowns, in October 2020, I started again, this time from scratch, and yesterday night for the first time my engine won its first game again TSCP engine (which is a great simple and very popular engine). The game is proudly attached below..
The picture, instead, shows, in the primitive interface, a variation of the Damiano's mate solved by the engine in about 3 seconds at depth 7.
I cannot express how I feel..Writing a chess engine is so complex that in many instances I thought that was too much for me, but my passion for chess and coding was stronger than bitboards,negamax, Zobrist keys, principal variations,quiescense, iterative deepening,...and all the other "mountains" I had to climb to get to this achievement which is for sure the most complex project I ever worked on. I still need to do a lot of work (fix some,many, nasty bugs here and there..and then add the opening book,Winboard interface to test it again other engines,a decent GUI,clean and optimize..) and the program is far away to be as strong as I would like plus I know for sure that it is going to be in progress forever but I guess that's what I wanted..
I wish to express all my gratitude to @Erel and the team for making and improving B4J, whithout it I, probably would have not restarted the project..
The program is not yet ready to be shared as jar or exe but when it will be ready I will share it.
PS: The name of the engine is STUChess (I know...I know...in Italian it sounds funny...I did it on purpose...) and with about an average of 0.4 millions NPS (Nodes Per Second) I estimate an ELO rating about 1800/1900 (I loose to it most of the time), but I need to make some more tests for sure to confirm that. The goal is 1M NPS and 2000+ ELO...
PPS: @Erel, remember the long XOR...the current version gets a lot of collision due to the int implementation of the HASH table.... BTW, any idea when the next rev of B4J will be released?
[White "STUChess1_0"]
[Black "tscp181"]
[Result "1-0"]
[ECO "A06"]
1. Nf3 d5 2. Nc3 d4 3. Nb5 e5 4. Nxe5 a6 5. Na3 Bxa3 6. bxa3 Nf6 7. e3 Qd5 8. Nf3 Nc6 9. Bb2 Bg4 10. Be2 dxe3 11. dxe3 Qe6
12. O-O O-O 13. Ng5 Qf5 14. Bxf6 Bxe2 15. Qxe2 Qxf6 16. Nf3 Rab8
17. e4 Qe7 18. Qe3 Rfe8 19. Rfe1 Qe6 20. e5 Rbd8 21. Rab1 b6 22. Qc3 Rd5 23. Kh1 Rc5 24. Qd3 Rd8 25. Qxa6 Rxc2 26. Qb7 Na5 27. Qe4 Rxa2 28. Ng5 Qh6 29. Qf5 Rf8 30. Rec1 c6 31. Rxb6 Rxa3
32. Re1 Rb3 33. Ra6 Rb5 34. Ra1 g6 35. Qf6 Nb3 36. Ra8 Rb7 37. e6 fxe6 38. Qxe6+ Kg7 39. Qe5+ Kg8 40. Qe6+ Kg7 41. Qxc6 Re7 42. Qc3+ Nd4 43. Qxd4+ Rf6 44. R1a7 Qxg5 45. Rxe7+ Kh6 46. Rxh7+
Kxh7 47. Qd7+ Rf7 48. Qxf7+ Kh6 49. Rh8# 1-0
During one of the COVID lockdowns, in October 2020, I started again, this time from scratch, and yesterday night for the first time my engine won its first game again TSCP engine (which is a great simple and very popular engine). The game is proudly attached below..
The picture, instead, shows, in the primitive interface, a variation of the Damiano's mate solved by the engine in about 3 seconds at depth 7.
I cannot express how I feel..Writing a chess engine is so complex that in many instances I thought that was too much for me, but my passion for chess and coding was stronger than bitboards,negamax, Zobrist keys, principal variations,quiescense, iterative deepening,...and all the other "mountains" I had to climb to get to this achievement which is for sure the most complex project I ever worked on. I still need to do a lot of work (fix some,many, nasty bugs here and there..and then add the opening book,Winboard interface to test it again other engines,a decent GUI,clean and optimize..) and the program is far away to be as strong as I would like plus I know for sure that it is going to be in progress forever but I guess that's what I wanted..
I wish to express all my gratitude to @Erel and the team for making and improving B4J, whithout it I, probably would have not restarted the project..
The program is not yet ready to be shared as jar or exe but when it will be ready I will share it.
PS: The name of the engine is STUChess (I know...I know...in Italian it sounds funny...I did it on purpose...) and with about an average of 0.4 millions NPS (Nodes Per Second) I estimate an ELO rating about 1800/1900 (I loose to it most of the time), but I need to make some more tests for sure to confirm that. The goal is 1M NPS and 2000+ ELO...
PPS: @Erel, remember the long XOR...the current version gets a lot of collision due to the int implementation of the HASH table.... BTW, any idea when the next rev of B4J will be released?
[White "STUChess1_0"]
[Black "tscp181"]
[Result "1-0"]
[ECO "A06"]
1. Nf3 d5 2. Nc3 d4 3. Nb5 e5 4. Nxe5 a6 5. Na3 Bxa3 6. bxa3 Nf6 7. e3 Qd5 8. Nf3 Nc6 9. Bb2 Bg4 10. Be2 dxe3 11. dxe3 Qe6
12. O-O O-O 13. Ng5 Qf5 14. Bxf6 Bxe2 15. Qxe2 Qxf6 16. Nf3 Rab8
17. e4 Qe7 18. Qe3 Rfe8 19. Rfe1 Qe6 20. e5 Rbd8 21. Rab1 b6 22. Qc3 Rd5 23. Kh1 Rc5 24. Qd3 Rd8 25. Qxa6 Rxc2 26. Qb7 Na5 27. Qe4 Rxa2 28. Ng5 Qh6 29. Qf5 Rf8 30. Rec1 c6 31. Rxb6 Rxa3
32. Re1 Rb3 33. Ra6 Rb5 34. Ra1 g6 35. Qf6 Nb3 36. Ra8 Rb7 37. e6 fxe6 38. Qxe6+ Kg7 39. Qe5+ Kg8 40. Qe6+ Kg7 41. Qxc6 Re7 42. Qc3+ Nd4 43. Qxd4+ Rf6 44. R1a7 Qxg5 45. Rxe7+ Kh6 46. Rxh7+
Kxh7 47. Qd7+ Rf7 48. Qxf7+ Kh6 49. Rh8# 1-0