Sapeli 1.0 - New chess engine

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

I added those binaries in this folder. In case those links die.
https://github.com/SamuraiDangyo/Sapeli ... naries/bin
It contains 1.0 + 1.01 + 1.02 + 1.11 + 1.20.

My latest development version was getting really buggy. So I had to revert back to 1.19 and bolt my improvements in.
Even move generator got faster. atm I'm only sorting tactical moves to save cycles.

Code: Select all

1.20
= nodes 875605409 mnps 21.061 time 41.575

1.23
= nodes 875605409 mnps 27.680 time 31.633
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.23

I feel like the new passed pawn code is working here.
[pgn][Event "?"] [Site "?"] [Date "2019.06.13"] [Round "3"] [White "Sapeli 1.23"] [Black "Crafty-23.4"] [Result "1-0"] [TimeControl "40/0.5"] [ECO "A05"] [Opening "Reti Opening"] [PlyCount "143"] 1. Nf3 {+0,13/5 1,6 s} 1... Nf6 {+0,05/8 0,9 s} 2. d4 {+0,13/5 1,7 s} 2... e6 {+0,10/7 0,9 s} 3. Nc3 {+0,08/4 1,5 s} 3... Nc6 {+0,00/6 0,4 s} 4. e4 {+0,16/4 1,5 s} 4... Bb4 {+0,22/5 0,2 s} 5. d5 {+0,19/4 1,5 s} 5... Bxc3+ {+0,11/5 0,3 s} 6. bxc3 {+0,47/6 1,5 s} 6... Ne7 {-0,14/6 0,3 s} 7. dxe6 {+0,47/4 1,4 s} 7... fxe6 {-0,27/6 0,6 s} 8. Bd3 {+0,37/4 1,3 s} 8... d5 {+0,21/6 0,4 s} 9. exd5 {+0,26/4 1,3 s} 9... Nexd5 {+0,53/7 0,7 s} 10. Bd2 {+0,31/4 1,2 s} 10... Qd6 {+0,62/7 0,4 s} 11. c4 {+0,41/2 1,1 s} 11... Nb4 {-0,12/6 1,0 s} 12. Be2 {+0,14/4 1,2 s} 12... O-O {+0,08/6 0,2 s} 13. Qb1 {+0,32/3 1,2 s} 13... Nc6 {-0,01/8 0,6 s} 14. O-O {+0,22/4 1,2 s} 14... Ne4 {-0,23/8 0,9 s} 15. Be3 {+0,22/3 1,1 s} 15... Nc3 {-0,35/8 0,4 s} 16. Qe1 {-0,30/4 1,1 s} 16... Nxe2+ {-0,19/9 0,8 s} 17. Qxe2 {-0,11/4 1,1 s} 17... Ne5 {-0,25/8 0,5 s} 18. Nxe5 {-0,02/4 1,2 s} 18... Qxe5 {-0,17/3 s} 19. Qd3 {+0,01/3 1,2 s} 19... b6 {-0,02/4 0,1 s} 20. f4 {+0,02/3 1,4 s} 20... Qh5 {-0,27/6 0,4 s} 21. Rab1 {+0,01/3 1,1 s} 21... Bb7 {-0,46/7 1,1 s} 22. Rb5 {+0,02/3 1,1 s} 22... Rf5 {-0,45/4 0,1 s} 23. Qd7 {-0,02/2 1,1 s} 23... Qg6 {-0,69/7 0,7 s} 24. Qd2 {-0,03/1 1,1 s} 24... Qg4 {-0,77/6 1,1 s} 25. h3 {-0,09/2 1,1 s} 25... Qg3 {-0,59/7 1,2 s} 26. Qf2 {-0,13/3 1,1 s} 26... Qxf2+ {-0,48/8 0,3 s} 27. Rxf2 {-0,17/4 1,1 s} 27... Ba6 {-0,67/9 0,7 s} 28. Rb4 {-0,18/4 1,1 s} 28... Ra5 {-0,94/9 0,7 s} 29. c5 {-1,08/4 1,2 s} 29... Rxa2 {-1,23/6 0,4 s} 30. Bd4 {-1,16/4 1,1 s} 30... Rd8 {-1,64/7 0,6 s} 31. cxb6 {-1,17/4 1,1 s} 31... cxb6 {-1,71/8 0,7 s} 32. c4 {-1,19/4 1,2 s} 32... Rxf2 {-1,71/8 0,4 s} 33. Bxf2 {-1,13/5 1,4 s} 33... Rd1+ {-1,69/8 0,4 s} 34. Kh2 {-1,11/6 1,2 s} 34... Rd2 {-1,58/7 0,2 s} 35. Kg1 {-1,13/5 1,2 s} 35... Bb7 {-1,20/6 0,5 s} 36. c5 {-1,04/5 1,1 s} 36... b5 {-0,57/7 0,6 s} 37. Rxb5 {+0,10/6 1,1 s} 37... Bc6 {-0,01/8 0,6 s} 38. Rb8+ {+0,21/6 1,1 s} 38... Kf7 {-0,56/3 s} 39. Rc8 {+0,27/5 1,2 s} 39... Rd1+ {+0,10/5 0,1 s} 40. Kh2 {+0,31/6 1,0 s} 40... Be8 {+0,41/7 0,6 s} 41. c6 {+0,65/6 1,7 s} 41... a5 {+0,16/8 1,1 s} 42. c7 {+0,66/5 1,7 s} 42... Rc1 {+2,04/10 0,9 s} 43. Bb6 {+1,70/5 1,5 s} 43... a4 {-0,27/1 s} 44. Rd8 {+4,22/6 1,6 s} 44... a3 {+2,45/7 0,1 s} 45. c8=Q {+4,45/5 1,5 s} 45... Rxc8 {+3,45/3 s} 46. Rxc8 {+5,50/6 1,4 s} 46... e5 {+4,73/5 0,3 s} 47. fxe5 {+5,83/5 1,4 s} 47... Bb5 {+6,27/8 0,4 s} 48. Rc7+ {+6,58/5 1,3 s} 48... Ke6 {+6,10/7 0,5 s} 49. Rxg7 {+6,57/5 1,3 s} 49... a2 {+5,55/10 1,0 s} 50. Ra7 {+6,55/6 1,2 s} 50... Bc4 {+5,50/10 0,4 s} 51. Bd4 {+6,62/5 1,2 s} 51... h6 {+5,61/9 0,5 s} 52. Rh7 {+7,61/5 1,1 s} 52... h5 {+5,64/8 0,7 s} 53. Rxh5 {+7,67/5 1,1 s} 53... Kd5 {+6,21/8 0,6 s} 54. Rh4 {+7,68/6 1,1 s} 54... Kc6 {+6,25/6 0,3 s} 55. Kg3 {+7,79/4 1,1 s} 55... Bd5 {+6,82/8 0,8 s} 56. Rh6+ {+7,89/5 1,2 s} 56... Kb5 {+7,44/7 0,2 s} 57. e6 {+8,18/5 1,1 s} 57... Kc4 {+7,70/7 0,4 s} 58. Be5 {+8,35/5 1,1 s} 58... Bc6 {+8,23/8 0,6 s} 59. e7 {+8,35/4 1,1 s} 59... Bd7 {+8,94/7 0,5 s} 60. Rh8 {+10,20/4 1,1 s} 60... Kd5 {+8,62/5 0,5 s} 61. e8=R {+10,29/5 1,3 s} 61... Bxe8 {+9,34/7 0,4 s} 62. Rxe8 {+10,33/6 1,1 s} 62... Kc4 {+12,61/7 0,4 s} 63. Ra8 {+12,16/5 1,2 s} 63... Kd5 {+9,27/2 s} 64. Kf4 {+12,29/5 1,2 s} 64... a1=Q {+13,35/4 s} 65. Rxa1 {+12,43/6 1,2 s} 65... Ke6 {+13,52/3 s} 66. Ra7 {+12,72/5 1,2 s} 66... Kd5 {+13,68/2 s} 67. Rc7 {+12,99/5 1,2 s} 67... Ke6 {+13,81/2 s} 68. g4 {+22,82/5 1,3 s} 68... Kd5 {+14,23/2 s} 69. g5 {+22,82/4 1,2 s} 69... Ke6 {+14,45/2 s} 70. g6 {+104,85/4 0,6 s} 70... Kd5 {+19,76/2 s} 71. g7 {+104,85/3 0,1 s} 71... Ke6 {+327,65/2 s} 72. g8=Q# {+104.85/2 0s, White mates} 1-0 [/pgn]
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

I added dynamic hash uci options for Sapeli.
You can set good moves hash + eval hash.
The more the better.
Also clear hash uci option.

If Sapeli leaks memory or there's some bugs/crashes I want to know.
It should be stable.
But you never know.
At least -bench didn't get any slower.

Sapeli 1.27:
Release: https://github.com/SamuraiDangyo/Sapeli ... s/tag/1.27
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.27

It is the same as 1.26 w/o dynamic hash. So if there is some bugs. 1.26 is the way to go.
Sapeli 1.26:
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.26
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

Sapeli 1.33
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.33
Release: https://github.com/SamuraiDangyo/Sapeli ... s/tag/1.33

Sapeli now compiles under clang / g++ / gcc without problems. As I removed some crab that wasn't necessary. Although clang builds are 7x slower. g++ builds are as good as gcc builds.

Some tests. Sapeli scores 90%+ against fairy now in 40 moves in 1 second games:

Code: Select all

standard / tc=40/1 /// Score of Sapeli 1.33 vs Fairy-Max 5.0b: 881 - 57 - 62 [0.912] 1000
chess960 / tc=40/.3 /// Score of Sapeli 1.33 vs Stockfish 8 64: 542 - 458 - 0 [0.542] 1000
More information about this release
https://github.com/SamuraiDangyo/Sapeli ... s.txt#L103

Code: Select all

*   - 1.33
*     + Removed jum_buf / simplifications
*     + Cast malloc for g++
*     + Removed bin folder: Binaries are here -> https://github.com/SamuraiDangyo/Sapeli/tree/binaries/bin
*     + gcc / g++ / clang can now all build ok
*     + gcc   -bench : = nodes 118301084 mnps 3.942 time 30.010
*     + g++   -bench : = nodes 111980203 mnps 3.731 time 30.010
*     + clang -bench : = nodes 20952140 mnps 0.698 time 30.018
*
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

Quick update. Not much difference to 1.33
Added go movetime / depth support. As there was a request + were very simple to add. UCI support is pretty minimal in Sapeli. As I don't like some aspects of it.

Here is Sapeli 1.34: https://github.com/SamuraiDangyo/Sapeli/tree/1.34
Release: https://github.com/SamuraiDangyo/Sapeli ... s/tag/1.34

new commands;

Code: Select all

go movetime 2000
info depth 0 nodes 40 time 0 nps 0 score cp 56 pv e2e3
info depth 1 nodes 248 time 2 nps 124000 score cp 0 pv e2e3
info depth 2 nodes 2754 time 9 nps 306000 score cp 40 pv d2d4
info depth 3 nodes 8855 time 23 nps 385000 score cp 0 pv c2c3
info depth 4 nodes 42316 time 80 nps 528950 score cp 18 pv d2d4
info depth 5 nodes 148267 time 206 nps 719742 score cp 8 pv b1c3
info depth 6 nodes 335418 time 377 nps 889702 score cp 20 pv e2e4
info depth 7 nodes 1038700 time 798 nps 1301629 score cp 14 pv e2e4
info depth 8 nodes 3539640 time 2001 nps 1768935 score cp 14 pv e2e4
bestmove e2e4

go depth 8
info depth 0 nodes 40 time 0 nps 0 score cp 56 pv e2e3
info depth 1 nodes 144 time 1 nps 144000 score cp 0 pv e2e3
info depth 2 nodes 1591 time 1 nps 1591000 score cp 40 pv d2d4
info depth 3 nodes 3800 time 2 nps 1900000 score cp 0 pv d2d4
info depth 4 nodes 15827 time 9 nps 1758555 score cp 18 pv d2d4
info depth 5 nodes 63498 time 24 nps 2645750 score cp 14 pv b1c3
info depth 6 nodes 136499 time 49 nps 2785693 score cp 15 pv b1c3
info depth 7 nodes 778239 time 309 nps 2518572 score cp 10 pv e2e4
info depth 8 nodes 2112449 time 810 nps 2607961 score cp 10 pv e2e4
info depth 9 nodes 2112449 time 810 nps 2607961 score cp 10 pv e2e4
bestmove e2e4

go movetime 500
info depth 0 nodes 40 time 0 nps 0 score cp 56 pv e2e3
info depth 1 nodes 140 time 0 nps 0 score cp 0 pv e2e3
info depth 2 nodes 1411 time 1 nps 1411000 score cp 40 pv d2d4
info depth 3 nodes 3586 time 2 nps 1793000 score cp 0 pv d2d4
info depth 4 nodes 21130 time 10 nps 2113000 score cp 22 pv b1c3
info depth 5 nodes 57460 time 20 nps 2873000 score cp 20 pv b1c3
info depth 6 nodes 223196 time 84 nps 2657095 score cp 18 pv e2e4
info depth 7 nodes 622038 time 225 nps 2764613 score cp 14 pv b1c3
info depth 8 nodes 1254007 time 501 nps 2503007 score cp 14 pv b1c3
bestmove b1c3

go depth 5
info depth 0 nodes 40 time 0 nps 0 score cp 56 pv e2e3
info depth 1 nodes 140 time 1 nps 140000 score cp 0 pv e2e3
info depth 2 nodes 1402 time 1 nps 1402000 score cp 40 pv d2d4
info depth 3 nodes 3452 time 2 nps 1726000 score cp 0 pv d2d4
info depth 4 nodes 15537 time 8 nps 1942125 score cp 23 pv b1c3
info depth 5 nodes 50883 time 18 nps 2826833 score cp 14 pv b1c3
info depth 6 nodes 50883 time 18 nps 2826833 score cp 14 pv b1c3
bestmove b1c3
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: Sapeli 1.0 - New chess engine

Post by Norbert Raimund Leisner »

Are anywhere Windows binaries 64-bit of Sapeli 1.34 - 1.35 available for download?
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: Sapeli 1.0 - New chess engine

Post by Roland Chastain »

Norbert Raimund Leisner wrote: Wed Jul 17, 2019 3:50 pm Are anywhere Windows binaries 64-bit of Sapeli 1.34 - 1.35 available for download?
Hello Norbert! Here you are.
Qui trop embrasse mal étreint.
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

Thanks to Ronald Chastain for builds! I added them to the list: https://github.com/SamuraiDangyo/Sapeli ... naries/bin

I download my source from github so I want Sapeli source code to be 60KB not MBs to quickly download.

Vey minor update:
+ Max moves 256 -> 218. Very very tiny speed boost.
+ Added -analyze. Not sure if this is useful to anyone. Might remove it in 1.37.
- Code: https://github.com/SamuraiDangyo/Sapeli ... li.c#L3728
+ Small fixes.
+ Checked for memory leaks with valgrind. No issues anymore.

Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.36
Release: https://github.com/SamuraiDangyo/Sapeli ... s/tag/1.36

As Sapeli has fast movegen it actually generates even games really fast. So -analyze just plays random moves and shows score of those games. Mostly draws because 3rep + 50move rule.

Code: Select all

./sapeli -analyze

Code: Select all

~~~ Analyze( 10000 ) ~~~
[ Fen: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq ]
[ Analysing ... ]
[ Score: 69 - 55 - 876 [0.51] 1000 ]
[ Score: 130 - 121 - 1749 [0.50] 2000 ]
[ Score: 174 - 185 - 2641 [0.50] 3000 ]
[ Score: 231 - 254 - 3515 [0.50] 4000 ]
[ Score: 299 - 293 - 4408 [0.50] 5000 ]
[ Score: 372 - 354 - 5274 [0.50] 6000 ]
[ Score: 441 - 417 - 6142 [0.50] 7000 ]
[ Score: 507 - 480 - 7013 [0.50] 8000 ]
[ Score: 567 - 540 - 7893 [0.50] 9000 ]
=
[ Time: 77.22s ]
[ Speed: 129.51 games/s ]
[ Score: 629 - 602 - 8769 [0.50] 10000 ]

Code: Select all

./sapeli -fen "6k1/RQPPR3/8/8/8/8/8/2K5 w - - 0 1" -analyze 30000 # white is winning

Code: Select all

...
[ Score: 10708 - 0 - 16292 [0.70] 27000 ]
[ Score: 11129 - 0 - 16871 [0.70] 28000 ]
[ Score: 11506 - 0 - 17494 [0.70] 29000 ]
=
[ Time: 31.80s ]
[ Speed: 943.42 games/s ]
[ Score: 11915 - 0 - 18085 [0.70] 30000 ]
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: Sapeli 1.0 - New chess engine

Post by Gabor Szots »

JohnWoe wrote: Wed Jul 24, 2019 10:51 am + Max moves 256 -> 218. Very very tiny speed boost.
+ Added -analyze. Not sure if this is useful to anyone. Might remove it in 1.37.
Max moves: Does that mean it can't make more than 218 moves?

Analyze: I am sure most people who use Sapeli welcome that feature.
Gabor Szots
CCRL testing group
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Sapeli 1.0 - New chess engine

Post by JohnWoe »

Gabor Szots wrote: Wed Jul 24, 2019 11:53 am
JohnWoe wrote: Wed Jul 24, 2019 10:51 am + Max moves 256 -> 218. Very very tiny speed boost.
+ Added -analyze. Not sure if this is useful to anyone. Might remove it in 1.37.
Max moves: Does that mean it can't make more than 218 moves?

Analyze: I am sure most people who use Sapeli welcome that feature.
Thanks for the feedback!
That max moves means maximum moves per position. Basically just for move generator. Gives a tiny speed boost. I measured ~+0.3 mnps.
Code: https://github.com/SamuraiDangyo/Sapeli ... peli.c#L59
There is this link: https://chess.stackexchange.com/questio ... -in-a-turn
As it seems that 218 is the maximum moves per position.

Analyze can stay for now. It is in 1.36 + 1.37. It prints results every 1000 games. Can stop it anytime you want.

Forgot in 1.36...
Added Draw_material() to Result(). Now Sapeli analyzes 10% faster.
Not much other difference to 1.36.
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.37
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: Sapeli 1.0 - New chess engine

Post by Gabor Szots »

JohnWoe wrote: Wed Jul 24, 2019 2:40 pm
Thanks for the feedback!
That max moves means maximum moves per position. Basically just for move generator. Gives a tiny speed boost. I measured ~+0.3 mnps.
Code: https://github.com/SamuraiDangyo/Sapeli ... peli.c#L59
There is this link: https://chess.stackexchange.com/questio ... -in-a-turn
As it seems that 218 is the maximum moves per position.

Analyze can stay for now. It is in 1.36 + 1.37. It prints results every 1000 games. Can stop it anytime you want.

Forgot in 1.36...
Added Draw_material() to Result(). Now Sapeli analyzes 10% faster.
Not much other difference to 1.36.
Source code: https://github.com/SamuraiDangyo/Sapeli/tree/1.37
I guess I misunderstood not only max moves but analyze as well. I thought it was analysis mode.
Gabor Szots
CCRL testing group