A complete 2000 lines of code engine

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

Moderators: hgm, Rebel, chrisw

tpoppins
Posts: 919
Joined: Tue Nov 24, 2015 9:11 pm
Location: upstate

Re: A complete 2000 lines of code engine

Post by tpoppins »

v0.4 exacts revenge on the greedy Monochrome with an extended king hunt:

[pgn][Event "?"] [Site "?"] [Date "2018.10.21"] [Round "?"] [White "Minic 0.4 64-bit"] [Black "Monochrome"] [Result "1-0"] [ECO "D10"] [GameDuration "00:03:24"] [GameEndTime "2018-10-21T19:43:45.111 Eastern Daylight Time"] [GameStartTime "2018-10-21T19:40:20.757 Eastern Daylight Time"] [Opening "QGD Slav defense"] [PlyCount "76"] [Termination "adjudication"] [TimeControl "40/120"] 1. d4 {book} d5 {book} 2. c4 {book} c6 {book} 3. Nc3 {book} Nf6 {book} 4. cxd5 {book} cxd5 {book} 5. Nf3 {book} Nc6 {book} 6. Bf4 {book} e6 {book} 7. e3 {0.00/8 2.9s} Ne4 {-0.36/5 3.5s} 8. Bd3 {+0.61/11 2.9s} g5 {-0.33/5 3.5s} 9. Bg3 {+0.44/10 2.9s} Bb4 {-0.13/4 3.6s} 10. Bxe4 {+0.68/10 2.9s} dxe4 {-0.02/6 3.5s} 11. Nd2 {+0.84/11 2.9s} f5 {-0.50/5 3.5s} 12. Qh5+ {+0.83/10 2.9s} Kd7 {-0.53/5 3.5s} 13. O-O-O {+1.14/9 2.9s} Bxc3 {-0.24/5 3.5s} 14. bxc3 {+1.18/10 2.9s} Qa5 {-0.47/6 3.6s} 15. Qf7+ {+1.82/10 2.9s} Ne7 {-0.42/5 3.5s} 16. Kb2 {+1.51/9 2.9s} h6 {-0.74/5 3.5s} 17. Rhe1 {+1.81/10 2.9s} Rg8 {-0.35/5 3.5s} 18. Be5 {+1.93/9 2.9s} a6 {-0.48/5 3.6s} 19. Nb3 {+2.19/10 2.9s} Qb5 {-1.20/5 3.5s} 20. Bg7 {+2.82/9 2.9s} Re8 {-1.24/5 3.6s} 21. Bxh6 {+2.23/10 2.9s} g4 {-1.76/5 3.5s} 22. Bg5 {+2.03/8 2.9s} b6 {-1.17/5 3.5s} 23. Bf6 {+1.77/8 2.9s} Bb7 {-0.96/5 3.6s} 24. Kb1 {+1.56/8 2.9s} a5 {-0.12/5 3.5s} 25. Ka1 {+1.49/9 2.9s} a4 {+0.14/5 3.5s} 26. Nc5+ {+2.23/10 2.9s} bxc5 {-0.51/5 3.5s} 27. dxc5+ {+2.29/10 2.9s} Bd5 {-1.09/5 3.6s} 28. Bxe7 {+1.88/10 2.9s} Qa5 {-0.99/6 3.6s} 29. Bf6+ {+6.54/9 2.9s} Kc6 {-1.20/5 3.5s} 30. c4 {+6.66/9 2.9s} Rad8 {-5.13/6 3.5s} 31. cxd5+ {+6.56/10 2.9s} exd5 {-5.48/6 3.5s} 32. Rb1 {+7.83/10 2.9s} Rb8 {-5.53/6 3.5s} 33. Rb6+ {+9.25/10 2.9s} Rxb6 {-8.05/6 3.5s} 34. Qxe8+ {+9.21/10 2.9s} Kb7 {-8.05/5 3.5s} 35. Rc1 {+9.33/10 2.9s} Qd2 {-7.73/5 3.5s} 36. Qd7+ {+14.27/11 2.9s} Ka6 {-12.10/6 3.5s} 37. Qc8+ {+15.26/12 2.9s} Ka5 {-12.81/6 3.5s} 38. cxb6 {+15.26/11 2.9s} Qxc1+ {-13.09/6 3.5s, White wins by adjudication} 1-0 [/pgn]

You keep referring to FairyMax but we don't have it on our lists. Wikipedia sez it's derived from Micro-Max and goes on state that it's about 1200-Elo strong. Hmm, Micro-Max is 1950 on our blitz list; something doesn't jibe here.
Tirsa Poppins
CCRL
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y »

Fairy-max is bundled with winboard and also available on any linux distri. It is around 1950elo and is indeed derived from micromax.
http://home.hccnet.nl/h.g.muller/CVfairy.html
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y »

tpoppins wrote: Mon Oct 22, 2018 1:25 am But it's 2200+ lines now, you cheat. ;)
2219 lines (1998 sloc) 69.2 KB 8-)
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: A complete 2000 lines of code engine

Post by Sven »

xr_a_y wrote: Sun Oct 21, 2018 10:02 pm Version 0.4 is available and is less stupid than the previous ones ... :lol:
Which changes were the most successful ones?
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y »

Sven wrote: Mon Oct 22, 2018 11:58 pm
xr_a_y wrote: Sun Oct 21, 2018 10:02 pm Version 0.4 is available and is less stupid than the previous ones ... :lol:
Which changes were the most successful ones?
Well, I am not in a good testing process but I think it was using rofchade PST, IID and disabling LMP (because SEE is not used yet in move sorting).

I think there are still some very bad bugs in there because the engine seems to be around 1850elo.

Still a good sandbox to identify such bugs I think.
User avatar
Ronald
Posts: 160
Joined: Tue Jan 23, 2018 10:18 am
Location: Rotterdam
Full name: Ronald Friederich

Re: A complete 2000 lines of code engine

Post by Ronald »

Nice that the rofchade PST is doing good.

Some suggestions, possible bugs:
I think currently an "B_alpha" never gets stored in the hash table:

Code: Select all

 if ( bestMove != INVALIDMOVE && !stopFlag){
     TT::setEntry({bestMove,alpha,alphaUpdated?TT::B_exact:TT::B_alpha,depth,computeHash(p)});
bestMove will only get a value if the score of a move beats alpha, so when all moves score below alpha the hashentry will never get stored.

You could change the moveloop of pvs, by first trying the hash move (if you have one) before generating and sorting the moves. Most of the time this will already lead to a cutoff and saves you the whole move generation and sorting.
Implementing SEE will probably also help a lot to divide good/bad captures. In addition in quiescence you could only search captures with a non negative SEE (except when in check), and after a certain depth (fi -5) only search recaptures
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y »

Thanks ! I fixed B_alpha case storing inside TT and try the TT move first now.
Not using bitboards, what kind of short SEE implementation are you recommanding ?
User avatar
Ronald
Posts: 160
Joined: Tue Jan 23, 2018 10:18 am
Location: Rotterdam
Full name: Ronald Friederich

Re: A complete 2000 lines of code engine

Post by Ronald »

I don't know, because I only have experience with bitboards..
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y »

Minic 0.6 is out and performs ok :D :

Code: Select all

Rank Name                          Elo     +/-   Games   Score   Draws  
   1 fairymax                      104      18    1178   64.5%   21.8%  
   2 Minic 0.5                     -41      16    1178   44.2%   33.0%  
   3 tscp181                       -61      18    1178   41.3%   23.3%  
User avatar
CMCanavessi
Posts: 1142
Joined: Thu Dec 28, 2017 4:06 pm
Location: Argentina

Re: A complete 2000 lines of code engine

Post by CMCanavessi »

Do you plan to upload binaries in the future, like with Weini, or do we need to compile it ourselves?
Follow my tournament and some Leela gauntlets live at http://twitch.tv/ccls