A complete 1200 lines of code engine (Dumb 1.4)

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

Moderators: hgm, Rebel, chrisw

abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

A complete 1200 lines of code engine (Dumb 1.4)

Post by abulmo2 »

I have updated Dumb to the version 1.4. The code is slightly more compact (1198* lines of code), and the strength has significantly improved. I guess it should be between 2300 - 2400 elo on the CCRL 40/4 list. As we are approaching the year 2020, with the end of windows 7, I only provide 64-bit compilation for Windows & Linux, targeting Nehalem CPU or higher.
Have fun with it.

* Excluding comments, blank lines, and punctuation.
Richard Delorme
User avatar
CMCanavessi
Posts: 1142
Joined: Thu Dec 28, 2017 4:06 pm
Location: Argentina

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by CMCanavessi »

Nice!!
Follow my tournament and some Leela gauntlets live at http://twitch.tv/ccls
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by xr_a_y »

:D :D :D :D :D

And very clean and readable
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by Guenther »

abulmo2 wrote: Thu Dec 19, 2019 12:27 am I have updated Dumb to the version 1.4. The code is slightly more compact (1198* lines of code), and the strength has significantly improved. I guess it should be between 2300 - 2400 elo on the CCRL 40/4 list. As we are approaching the year 2020, with the end of windows 7, I only provide 64-bit compilation for Windows & Linux, targeting Nehalem CPU or higher.
Have fun with it.

* Excluding comments, blank lines, and punctuation.
Richard could you please add a non popcount pre-SSE4.2 build too?
(A pity I have never compiled D before)
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by abulmo2 »

Guenther wrote: Thu Dec 19, 2019 8:00 am Richard could you please add a non popcount pre-SSE4.2 build too?
I replaced the executable in the windows zip file, targeting core2 CPU. Dumb does not use popcount, and the raw speed does not seem affected (tested on an old core i7). Hope it works on your CPU.
(A pity I have never compiled D before)
Compiling D is not much harder than compiling C or C++.
You need to install Visual C++ (a free edition is OK).
You the need to install ldc2. ldc2 is a llvm based compiler, giving good compatibility with recent d version and highly optimized language.
Then launch a terminal from the visual c++ menu targeting your system and Make sure ldc2 is on your path.
You can the use the following commands to make an optimized executable:

Code: Select all

cd <dumb source code>
<ldc2 path>ldc2 -O3 -release -singleobj -flto=full -mcpu=native -fprofile-instr-generate dumb.d util.d board.d eval.d move.d search.d
dumb -b 8
<ldc2 path>ldc-profdata merge -output=dumb.profdata default.profraw
<ldc2 path>ldc2 -O3 -release -singleobj -flto=full -mcpu=native -fprofile-instr-use=dumb.profdata dumb.d util.d board.d eval.d move.d search.d
There is a gui interface to use and compile D (Visual D, etc.), but I prefer to use the command line. Traditional D code usually uses dub to provide D package (similar to cargo of the Rust language), but it is not as easy to provide a profile guided optimized executable.
For people interested in the D language, you have a list of books available. The Programming in D by Ali Çehreli is a very good and complete reference book to learn the language.
Richard Delorme
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by Guenther »

abulmo2 wrote: Fri Dec 20, 2019 9:40 am
Guenther wrote: Thu Dec 19, 2019 8:00 am Richard could you please add a non popcount pre-SSE4.2 build too?
I replaced the executable in the windows zip file, targeting core2 CPU. Dumb does not use popcount, and the raw speed does not seem affected (tested on an old core i7). Hope it works on your CPU.
(A pity I have never compiled D before)
Compiling D is not much harder than compiling C or C++.
You need to install Visual C++ (a free edition is OK).
You the need to install ldc2. ldc2 is a llvm based compiler, giving good compatibility with recent d version and highly optimized language.
Then launch a terminal from the visual c++ menu targeting your system and Make sure ldc2 is on your path.
You can the use the following commands to make an optimized executable:

Code: Select all

cd <dumb source code>
<ldc2 path>ldc2 -O3 -release -singleobj -flto=full -mcpu=native -fprofile-instr-generate dumb.d util.d board.d eval.d move.d search.d
dumb -b 8
<ldc2 path>ldc-profdata merge -output=dumb.profdata default.profraw
<ldc2 path>ldc2 -O3 -release -singleobj -flto=full -mcpu=native -fprofile-instr-use=dumb.profdata dumb.d util.d board.d eval.d move.d search.d
There is a gui interface to use and compile D (Visual D, etc.), but I prefer to use the command line. Traditional D code usually uses dub to provide D package (similar to cargo of the Rust language), but it is not as easy to provide a profile guided optimized executable.
For people interested in the D language, you have a list of books available. The Programming in D by Ali Çehreli is a very good and complete reference book to learn the language.
Thanks for the new compile! It is may be dumb, but pretty fast, even on my old slow Quadcore.
Don't think I have seen ~ 3.3Mn/s for a single core version ever.

Thanks also for the help and info about compiling in D.
I will try it in the next weeks. A pity that there seems to be no, or no reliable package for compiling D in Msys2, which I use now exclusively for compiling C and C++ (with GCC and G++).
My previous investigations showed that GDC asked for trouble and isn't recommended and may be even dead since years.

Code: Select all

uci
id name dumb 1.4
id author Richard Delorme
option name Ponder type check default false
option name Hash type spin default 64 min 1 max 65536
uciok
ucinewgame
go depth 13
info depth 1 score cp 41 nps 18445 time 1 nodes 20 pv d2d4
info depth 2 score cp 17 nps 33859 time 3 nodes 97 pv d2d4 d7d5
info depth 3 score cp 41 nps 128157 time 4 nodes 542 pv g1f3 d7d6 d2d4
info depth 4 score cp 17 nps 392157 time 6 nodes 2430 pv g1f3 b8c6 d2d4 d7d5
info depth 5 score cp 40 nps 1037318 time 10 nodes 10813 pv d2d4 d7d5 g1f3 b8c6 c1e3
info depth 6 score cp 17 nps 1953703 time 24 nodes 46411 pv d2d4 d7d5 g1f3 b8c6 c1e3 c8f5
info depth 7 score cp 31 nps 2502203 time 52 nodes 130886 pv d2d4 d7d5 g1f3 b8c6 c1e3 c8f5 b1c3
info depth 8 score cp 20 nps 2905118 time 164 nodes 476641 pv d2d4 d7d5 e2e3 b8c6 b1c3 c8f5 g2g4 f5e6
info depth 9 score cp 35 nps 3116040 time 545 nodes 1697507 pv e2e4 d7d5 e4d5 g8f6 d2d4 f6d5 g1f3 c8g4 f1d3
info depth 10 score cp 24 nps 3200663 time 1756 nodes 5621170 pv d2d4 d7d5 e2e3 g8f6 g1f3 e7e6 f3e5 b8d7 f1b5 f6e4
info depth 11 score cp 38 nps 3253668 time 6532 nodes 21253714 pv g1f3 e7e6 b1c3 b8c6 e2e4 d7d5 f1b5 d5e4 c3e4 d8d5 d1e2
info depth 12 score cp 24 nps 3270220 time 21165 nodes 69214045 pv g1f3 b8c6 d2d4 g8f6 b1c3 e7e6 e2e4 d7d5 e4e5 f6e4 c3e4 d5e4
info depth 13 score cp 33 nps 3298502 time 44337 nodes 146244576 pv g1f3 b8c6 d2d4 g8f6 b1c3 d7d5 e2e3 e7e6 f1d3 f8d6 e1g1 e8g8 c1d2
bestmove g1f3
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: A complete 1200 lines of code engine (Dumb 1.4)

Post by abulmo2 »

Guenther wrote: Fri Dec 20, 2019 10:09 am A pity that there seems to be no, or no reliable package for compiling D in Msys2, which I use now exclusively for compiling C and C++ (with GCC and G++).
My previous investigations showed that GDC asked for trouble and isn't recommended and may be even dead since years.
GDC is not dead at all. It is now part of GCC (as GNU Compiler Collection) since version 9. To be compilable, it needs to use and old D frontend written in C++, so it is outdated compared to ldc2. But future version will use more modern frontend written in D (and compilable with gdc 9). Just wait for GCC 10.
Richard Delorme
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: A complete 1200 lines of code engine (Dumb 1.5)

Post by abulmo2 »

I have updated dumb to version 1.5. Dumb code is still very compact (1217 lines of code) but the engine is now much stronger. Enhancements concern move sorting (bad capture + history), search reduction (LMR) and pruning (SEE pruning during quiescence search) and a retuned evaluation function. I hope this version to be about 200 elo stronger than version 1.4.
https://github.com/abulmo/Dumb/releases/tag/v1.5
Richard Delorme
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: A complete 1200 lines of code engine (Dumb 1.5)

Post by Gabor Szots »

abulmo2 wrote: Mon Nov 09, 2020 11:43 am I have updated dumb to version 1.5. Dumb code is still very compact (1217 lines of code) but the engine is now much stronger. Enhancements concern move sorting (bad capture + history), search reduction (LMR) and pruning (SEE pruning during quiescence search) and a retuned evaluation function. I hope this version to be about 200 elo stronger than version 1.4.
https://github.com/abulmo/Dumb/releases/tag/v1.5
Congratulations for the fantastic progress! I'm starting a test this afternoon.
Gabor Szots
CCRL testing group
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: A complete 1200 lines of code engine (Dumb 1.5)

Post by xr_a_y »

abulmo2 wrote: Mon Nov 09, 2020 11:43 am I have updated dumb to version 1.5. Dumb code is still very compact (1217 lines of code) but the engine is now much stronger. Enhancements concern move sorting (bad capture + history), search reduction (LMR) and pruning (SEE pruning during quiescence search) and a retuned evaluation function. I hope this version to be about 200 elo stronger than version 1.4.
https://github.com/abulmo/Dumb/releases/tag/v1.5
Great engine ! such a clear code, D is great.