A complete 2000 lines of code engine

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Mon Jul 29, 2019 9:40 am

M ANSARI wrote:
Mon Jul 29, 2019 9:13 am
Can I ask what the present number of line the code is now? Would be interesting to see if it can still do well without going over 2000 lines or if 2000 is a number that hurts progress significantly.
There are 3395 real lines of code in a file with 3806 total lines.
Being under 2000 seems not possible or very hard with SMP/Bitboards and including protocol (xboard or uci).
Minic code is still very readable, pushing it under 3000 lines would make not easy to read.

Code: Select all

3806 lines (3395 sloc) 197 KB 
Protocol is around 400 lines
Search is around 600 lines
TB is around 100 lines
Eval is around 300 lines
Material hash thing is about 400 lines
Bitboard & tools 400 lines
Position, tools, ... 1100 lines => some lines can be gained here ...

I can/will get under 3000 used lines if I clean up the code.

JohnWoe
Posts: 73
Joined: Sat Mar 02, 2013 10:31 pm

Re: A complete 2000 lines of code engine

Post by JohnWoe » Mon Jul 29, 2019 10:23 am

Regarding lines. Stockfish's search 743 lines. :D

starts -> line 560: https://github.com/official-stockfish/S ... h.cpp#L560
ends -> line: 1303: https://github.com/official-stockfish/S ... .cpp#L1303

User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Mon Aug 05, 2019 12:42 pm

Recent Gauntlet for Minic dev

Code: Select all

   1 zurichess-neuchatel           194      51     168   75.3%   23.2%
   2 Winter                        143      48     169   69.5%   24.3%
   3 Topple                         90      46     169   62.7%   26.0%
   4 asymptote_v0.6                 33      45     170   54.7%   27.1%
   5 ruy-1.1.9                       0      45     169   50.0%   25.4%

User avatar
flok
Posts: 156
Joined: Tue Jul 03, 2018 8:19 am
Full name: Folkert van Heusden
Contact:

Re: A complete 2000 lines of code engine

Post by flok » Mon Aug 05, 2019 2:05 pm

Micah is 1842 lines! With UCI, lazy-SMP, tuning, table-bases!





(but to be honest: it uses libchess & fathom 8-) )
www.vanheusden.com: Micah / Embla / PuppetMaster / DeepBrutePos / Pos / Feeks

User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Mon Aug 05, 2019 5:24 pm

flok wrote:
Mon Aug 05, 2019 2:05 pm
Micah is 1842 lines! With UCI, lazy-SMP, tuning, table-bases!
(but to be honest: it uses libchess & fathom 8-) )
I think it is good to keep the code small and simple.
Minic is still easily readable despite the long lines.
My advice would be to keep Micah this way, especially as it is based on some useful dependency, this is a great opportunity to stay clean as mainly search and eval has to be implemented.

Really hope the next 600 elo won't cost you 1200 lines :wink:

Code: Select all

Score of Micah vs minic_dev: 3 - 196 - 8 [0.034]
Elo difference: -582.4 +/- 126.9, LOS: 0.0 %, DrawRatio: 3.9 %
Here is one of the 3 Micah's wins as black successfully pushing a passed pawn! Totally outplaying Minic 8-) (this was short TC 40/20sec and Minic is finding 46. h2h3 only at depth 14 ... only reached depth 13 during the game ... too bad)


User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Wed Aug 14, 2019 1:28 pm

some recent progress @TC 40/1min 1024M hash (around CCRL40/4), here Minic dev version head to head with various engines :)

Code: Select all

   1 Winter                        167      54     143   72.4%   23.1%
   2 zurichess-neuchatel            61      50     143   58.7%   26.6%
   3 Topple                         42      45     142   56.0%   40.1%
   4 ruy-1.1.9                      -5      48     143   49.3%   28.7%
   5 asymptote_v0.6                 -7      48     144   49.0%   28.5%
   6 minic_0.85                    -10      31     143   48.6%   70.6%
   7 minic_0.82                    -32      37     143   45.5%   58.7%
   8 minic_0.76                    -34      41     143   45.1%   49.7%
   9 minic_0.65                    -97      44     144   36.5%   41.0%   

User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Thu Aug 15, 2019 7:50 am

Some Windows results, same TC and hash, native VS build

Code: Select all

Rank Name                          Elo     +/-   Games   Score   Draws
   0 Minic                          18      14    1775   52.6%   27.9%
   1 Winter_0.6_New_Windows         99      28     443   63.9%   27.5%
   2 Topple_0.7.1                   -2      27     444   49.8%   32.0%
   3 rofChade 1                    -28      28     444   45.9%   26.6%
   4 fruit_21                     -146      29     444   30.2%   25.7%

1775 of 4000 games finished.

User avatar
xr_a_y
Posts: 663
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: A complete 2000 lines of code engine

Post by xr_a_y » Fri Aug 16, 2019 7:25 am

Minic is finally getting >1000 at STS @10sec per position (single core, on quite old hardware) : 1051 :) still not very smart but that's better.

Post Reply