Drofa 1.0

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

Moderators: hgm, Rebel, chrisw

No4b
Posts: 105
Joined: Thu Jun 18, 2020 3:21 pm
Location: Moscow
Full name: Alexander Litov

Drofa 1.0

Post by No4b »

Hello everyone,

Some time ago i came to this forum because i needed help with an AI for my chess-like game.
The process of learning chess-programming was so exciting that i decided to try and work on some real chess engine.
At the same time I am way too lazy to write it from scratch, thus i decided to fork weak engine and try to improve it as much as i could.

I forked ShallowBlue (1713 rating at CCRL). Its under MIT, so i suppose i can do it, as long as i include original author in the licence? I`m really new to github and licensing stuff.

My first goal i tried to improve it so it could be on par with famous VICE
After a month of coding and testing, this is the list of what i improved:

-Complete hashtable and pawn hashtable rewrite.
-KingSafety eval rewrite (although it is the most questionable elo-gainer)
-General evaluation rescaling
-QSearch move generator added
-Null move pruning added
-Delta pruning added (very lazily implemented, still prune something though :D )
-A lot of code refactoring and optimization (~7-8 time faster in knps).
-Some bugfixes in the search in eval code.

All of this resulted in my Drofa engine (I suppose this can count as separate engine?).
I tested stability and strenght of it in 500-games match vs VICE (60s +1s), and surprisingly, Drofa not only didnt crush, but even won it!

Code: Select all

Score of Drofa vs vice: 212 - 147 - 141 [0.565]
Elo difference: 45.42 +/- 25.95
Althought after i tried to test windows compilies, they were much slower then ubuntu one
(i suppose Ryzen processor on my Windows PC may be also the reason).
I would appreciate if someone here could test NPS of my thing compared to the VICE on the windows computer with INTEL processor.

I deposited all of this on github:
https://github.com/justNo4b/Drofa

As long as i`m interested, i will continue my work on it.
I hope one day this engine will reach ~2500 ccrl, or may be even reach top-100 on it (aim high and all) :)
User avatar
Laskos
Posts: 10948
Joined: Wed Jul 26, 2006 10:21 pm
Full name: Kai Laskos

Re: Drofa 1.0

Post by Laskos »

No4b wrote: Mon Aug 31, 2020 10:22 pm Hello everyone,

Some time ago i came to this forum because i needed help with an AI for my chess-like game.
The process of learning chess-programming was so exciting that i decided to try and work on some real chess engine.
At the same time I am way too lazy to write it from scratch, thus i decided to fork weak engine and try to improve it as much as i could.

I forked ShallowBlue (1713 rating at CCRL). Its under MIT, so i suppose i can do it, as long as i include original author in the licence? I`m really new to github and licensing stuff.

My first goal i tried to improve it so it could be on par with famous VICE
After a month of coding and testing, this is the list of what i improved:

-Complete hashtable and pawn hashtable rewrite.
-KingSafety eval rewrite (although it is the most questionable elo-gainer)
-General evaluation rescaling
-QSearch move generator added
-Null move pruning added
-Delta pruning added (very lazily implemented, still prune something though :D )
-A lot of code refactoring and optimization (~7-8 time faster in knps).
-Some bugfixes in the search in eval code.

All of this resulted in my Drofa engine (I suppose this can count as separate engine?).
I tested stability and strenght of it in 500-games match vs VICE (60s +1s), and surprisingly, Drofa not only didnt crush, but even won it!

Code: Select all

Score of Drofa vs vice: 212 - 147 - 141 [0.565]
Elo difference: 45.42 +/- 25.95
Althought after i tried to test windows compilies, they were much slower then ubuntu one
(i suppose Ryzen processor on my Windows PC may be also the reason).
I would appreciate if someone here could test NPS of my thing compared to the VICE on the windows computer with INTEL processor.

I deposited all of this on github:
https://github.com/justNo4b/Drofa

As long as i`m interested, i will continue my work on it.
I hope one day this engine will reach ~2500 ccrl, or may be even reach top-100 on it (aim high and all) :)
Congratulations! Works well!

The output for "go depth 10" from starting position is:

go depth 10

Code: Select all

HASH_size 10922664
info depth 1 seldepth 1 nodes 45 score cp 53 nps 45000 time 1 pv d2d4
info depth 2 seldepth 2 nodes 158 score cp 0 nps 158000 time 1 pv d2d4 d7d5
info depth 3 seldepth 4 nodes 1228 score cp 29 nps 409333 time 3 pv d2d4 d7d5 g1f3
info depth 4 seldepth 6 nodes 4110 score cp 0 nps 587142 time 7 pv d2d4 d7d5 g1f3 g8f6
info depth 5 seldepth 7 nodes 26093 score cp 28 nps 1003576 time 26 pv d2d4 d7d5 g1f3 g8f6 c1f4
info depth 6 seldepth 9 nodes 96208 score cp 10 nps 1023489 time 94 pv e2e4 d7d5 f1b5 c8d7 b5d3 g8f6
info depth 7 seldepth 10 nodes 400259 score cp 27 nps 1081781 time 370 pv d2d4 d7d5 b1c3 g8f6 c1f4 c8f5 e2e3
info depth 8 seldepth 12 nodes 1483051 score cp 19 nps 1051063 time 1411 pv e2e4 e7e6 d2d4 d7d5 b1c3 f8b4 d1f3 b4c3
info depth 9 seldepth 13 nodes 4471078 score cp 22 nps 39486 time 4460 pv b1c3 d7d5 d2d4 e7e6 e2e3 f8b4 c1d2 g8f6 f1d3
info depth 10 seldepth 15 nodes 13851292 score cp 20 nps 75404 time 12816 pv e2e4 e7e5 d2d4 e5d4 d1d4 b8c6 d4c4 g8f6 b1c3 f8d6
bestmove e2e4
About 1.05 million NPS on my i7 4790 3.8 GHz Intel CPU, a fast NPS. I cannot find VICE 1.0 binary online, maybe you can upload it somewhere. Observe that NPS shown by the engine is mangled when nodes goes above 2 million.

Here is on 30 positions:

Engine: Drofa 1.0.0


n/s: 1.052.747

TotTime: 16:34m
Ply: 0 Positions: 30 Avg Nodes: 0 Branching = 0.00
Ply: 1 Positions: 30 Avg Nodes: 443 Branching = 0.00
Ply: 2 Positions: 30 Avg Nodes: 2503 Branching = 5.65
Ply: 3 Positions: 30 Avg Nodes: 9652 Branching = 3.86
Ply: 4 Positions: 30 Avg Nodes: 28524 Branching = 2.96
Ply: 5 Positions: 30 Avg Nodes: 113614 Branching = 3.98
Ply: 6 Positions: 30 Avg Nodes: 377348 Branching = 3.32
Ply: 7 Positions: 30 Avg Nodes: 1376678 Branching = 3.65
Ply: 8 Positions: 30 Avg Nodes: 3882781 Branching = 2.82
Ply: 9 Positions: 30 Avg Nodes:11325760 Branching = 2.92

Effective Branching Factor is a bit larger than 3.0.
No4b
Posts: 105
Joined: Thu Jun 18, 2020 3:21 pm
Location: Moscow
Full name: Alexander Litov

Re: Drofa 1.0

Post by No4b »

go depth 10

Code: Select all

HASH_size 10922664
info depth 1 seldepth 1 nodes 45 score cp 53 nps 45000 time 1 pv d2d4
info depth 2 seldepth 2 nodes 158 score cp 0 nps 158000 time 1 pv d2d4 d7d5
info depth 3 seldepth 4 nodes 1228 score cp 29 nps 409333 time 3 pv d2d4 d7d5 g1f3
info depth 4 seldepth 6 nodes 4110 score cp 0 nps 587142 time 7 pv d2d4 d7d5 g1f3 g8f6
info depth 5 seldepth 7 nodes 26093 score cp 28 nps 1003576 time 26 pv d2d4 d7d5 g1f3 g8f6 c1f4
info depth 6 seldepth 9 nodes 96208 score cp 10 nps 1023489 time 94 pv e2e4 d7d5 f1b5 c8d7 b5d3 g8f6
info depth 7 seldepth 10 nodes 400259 score cp 27 nps 1081781 time 370 pv d2d4 d7d5 b1c3 g8f6 c1f4 c8f5 e2e3
info depth 8 seldepth 12 nodes 1483051 score cp 19 nps 1051063 time 1411 pv e2e4 e7e6 d2d4 d7d5 b1c3 f8b4 d1f3 b4c3
info depth 9 seldepth 13 nodes 4471078 score cp 22 nps 39486 time 4460 pv b1c3 d7d5 d2d4 e7e6 e2e3 f8b4 c1d2 g8f6 f1d3
info depth 10 seldepth 15 nodes 13851292 score cp 20 nps 75404 time 12816 pv e2e4 e7e5 d2d4 e5d4 d1d4 b8c6 d4c4 g8f6 b1c3 f8d6
bestmove e2e4
About 1.05 million NPS on my i7 4790 3.8 GHz Intel CPU, a fast NPS. I cannot find VICE 1.0 binary online, maybe you can upload it somewhere.


Thank you for checking this.
My Ubuntu compile seems to work faster in weaker Intel Core i5 8300H (~2 million nps).
I should work on the better cross-compiling in the next round of work.
Observe that NPS shown by the engine is mangled when nodes goes above 2 million.
I think this crumbling is visual bug in the console mode (i actually always run engine through CuteChess so never noticed it). I tried to divide 13851292 onto 12816 and it should be 1 million nps.
Thank you for spotting this, i`ll look into it
chysiddh14
Posts: 38
Joined: Tue Jan 01, 2019 9:34 am
Full name: Siddhartha Chaudhary

Re: Drofa 1.0

Post by chysiddh14 »

Drofa_v.1.0 which file type is it ?
Gabor Szots
Posts: 1364
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: Drofa 1.0

Post by Gabor Szots »

About 1M nps here (i5-4690K at 3.5 GHz). Could not obtain Vice nps.

BTW, compiled well, only had to put #include <string> in option.h (Windows system).
Gabor Szots
CCRL testing group
User avatar
Guenther
Posts: 4607
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Drofa 1.0

Post by Guenther »

No4b wrote: Mon Aug 31, 2020 10:22 pm
...

Althought after i tried to test windows compilies, they were much slower then ubuntu one
(i suppose Ryzen processor on my Windows PC may be also the reason).
I would appreciate if someone here could test NPS of my thing compared to the VICE on the windows computer with INTEL processor.
Thanks for the release.

For the people who did not find Vice 1.0 for download, just check the XB/UCI chronology ;-)
The given wayback link still has a working Vice 1.0 download link (1.1 will not work there) and it also contains a 64-bit version unlike the 1.1 link from CCW (Norbert).
Vice 1.1 is identical to 1.0 though, except it can use a polyglot book.

I added it only below because of the speed diff.

Here are some data points on my slow old core2 quadcore. (SSE4.1/no popcnt)
(Vice 1.0-64, Vice 1.1-32, Drofa 1.0-64)

Ofc I also observed the nps calculation glitch since depth 9, mentioned by Laskos.

Code: Select all

Vice 1.0-64  1.483.364 nps
Vice 1.1-32  1.273.398 nps
Drofa 1.0-64   606.964 nps

Code: Select all

HashTable init complete with 2796200 entries
Welcome to Vice! Type 'vice' for console mode...
uci
id name Vice 1.0
id author Bluefever
option name Hash type spin default 64 min 4 max 1024
uciok
ucinewgame

Game Board:

8    r  n  b  q  k  b  n  r
7    p  p  p  p  p  p  p  p
6    .  .  .  .  .  .  .  .
5    .  .  .  .  .  .  .  .
4    .  .  .  .  .  .  .  .
3    .  .  .  .  .  .  .  .
2    P  P  P  P  P  P  P  P
1    R  N  B  Q  K  B  N  R

     a  b  c  d  e  f  g  h
side:w
enPas:99
castle:KQkq
PosKey:4C771354DCBA3180
go infinite
Seen Go..
time:-1 start:4255504 stop:0 depth:64 timeset:0
info score cp 30 depth 1 nodes 21 time 16 pv d2d4
info score cp 0 depth 2 nodes 89 time 16 pv d2d4 d7d5
info score cp 25 depth 3 nodes 694 time 31 pv d2d4 d7d5 c1e3
info score cp 0 depth 4 nodes 3667 time 31 pv d2d4 d7d5 c1e3 c8e6
info score cp 25 depth 5 nodes 10577 time 47 pv e2e4 e7e5 d2d4 d7d5 c1e3
info score cp 5 depth 6 nodes 61445 time 109 pv e2e4 e7e5 d2d4 b8c6 g1f3 f8d6
info score cp 22 depth 7 nodes 176808 time 187 pv e2e4 d7d5 e4d5 d8d5 d2d4 e7e5 c1e3
info score cp 5 depth 8 nodes 1308172 time 998 pv e2e4
info score cp 22 depth 9 nodes 2754271 time 1981 pv e2e4 e7e6 d2d4 d7d5 b1c3 d5e4 c3e4 f8b4 c2c3
info score cp 12 depth 10 nodes 18814339 time 12932 pv e2e4
info score cp 20 depth 11 nodes 38738052 time 26115 pv e2e4 e7e5 g1f3

Code: Select all

Book File Not Read
HashTable init complete with 2796200 entries
Welcome to Vice! Type 'vice' for console mode...
uci
id name Vice 1.1
id author Bluefever
option name Hash type spin default 64 min 4 max 1024
option name Book type check default true
uciok
ucinewgame

Game Board:

8    r  n  b  q  k  b  n  r
7    p  p  p  p  p  p  p  p
6    .  .  .  .  .  .  .  .
5    .  .  .  .  .  .  .  .
4    .  .  .  .  .  .  .  .
3    .  .  .  .  .  .  .  .
2    P  P  P  P  P  P  P  P
1    R  N  B  Q  K  B  N  R

     a  b  c  d  e  f  g  h
side:w
enPas:99
castle:KQkq
PosKey:4C771354DCBA3180
go infinite
Seen Go..
time:-1 start:4718733 stop:4227372 depth:64 timeset:0
info score cp 30 depth 1 nodes 21 time 0 pv d2d4
info score cp 0 depth 2 nodes 89 time 16 pv d2d4 d7d5
info score cp 25 depth 3 nodes 694 time 16 pv d2d4 d7d5 c1e3
info score cp 0 depth 4 nodes 3667 time 32 pv d2d4 d7d5 c1e3 c8e6
info score cp 25 depth 5 nodes 10577 time 47 pv e2e4 e7e5 d2d4 d7d5 c1e3
info score cp 5 depth 6 nodes 61445 time 110 pv e2e4 e7e5 d2d4 b8c6 g1f3 f8d6
info score cp 22 depth 7 nodes 176808 time 203 pv e2e4 d7d5 e4d5 d8d5 d2d4 e7e5 c1e3
info score cp 5 depth 8 nodes 1308172 time 1155 pv e2e4
info score cp 22 depth 9 nodes 2754271 time 2294 pv e2e4 e7e6 d2d4 d7d5 b1c3 d5e4 c3e4 f8b4 c2c3
info score cp 12 depth 10 nodes 18814339 time 15117 pv e2e4
info score cp 20 depth 11 nodes 38738052 time 30421 pv e2e4 e7e5 g1f3

Code: Select all

Drofa 1.0.0 by Rhys Rustad-Elliott and Litov Alexander (built Aug 31 2020 21:21:59)
uci
id name Drofa 1.0.0
id authors Rhys Rustad-Elliott and Alexander Litov

option name BookPath type string default book.bin
option name OwnBook type check default false
uciok
ucinewgame
isready
readyok
go infinite
HASH_size 10922664
info depth 1 seldepth 1 nodes 45 score cp 53 nps 45000 time 1 pv d2d4
info depth 2 seldepth 2 nodes 158 score cp 0 nps 52666 time 3 pv d2d4 d7d5
info depth 3 seldepth 4 nodes 1228 score cp 29 nps 204666 time 6 pv d2d4 d7d5 g1f3
info depth 4 seldepth 6 nodes 4110 score cp 0 nps 274000 time 15 pv d2d4 d7d5 g1f3 g8f6
info depth 5 seldepth 7 nodes 26093 score cp 28 nps 474418 time 55 pv d2d4 d7d5 g1f3 g8f6 c1f4
info depth 6 seldepth 9 nodes 96208 score cp 10 nps 531535 time 181 pv e2e4 d7d5 f1b5 c8d7 b5d3 g8f6
info depth 7 seldepth 10 nodes 400259 score cp 27 nps 583467 time 686 pv d2d4 d7d5 b1c3 g8f6 c1f4 c8f5 e2e3
info depth 8 seldepth 12 nodes 1483051 score cp 19 nps 592036 time 2505 pv e2e4 e7e6 d2d4 d7d5 b1c3 f8b4 d1f3 b4c3
info depth 9 seldepth 13 nodes 4471078 score cp 22 nps 23860 time 7381 pv b1c3 d7d5 d2d4 e7e6 e2e3 f8b4 c1d2 g8f6 f1d3
info depth 10 seldepth 15 nodes 13851292 score cp 20 nps 42344 time 22822 pv e2e4 e7e5 d2d4 e5d4 d1d4 b8c6 d4c4 g8f6 b1c3 f8d6
info depth 11 seldepth 18 nodes 31394584 score cp 25 nps 25709 time 51724 pv e2e4 d7d5 e4d5 d8d5 b1c3 d5e6 g1e2 e6b6 d2d4 e7e6 c1f4
https://rwbc-chess.de

trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
User avatar
Guenther
Posts: 4607
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Drofa 1.0

Post by Guenther »

With my own build I could increase the speed for my hardware by around 50%.

Code: Select all

g++ -Wall -std=c++11 -O3 -flto -pthread -mtune=generic -fno-exceptions -static -march=native src/*.cc -o drofa_10
(and fixing options.h like Gabor said)
Nps at depth 11 now 903.909.

Code: Select all

Drofa 1.0.0 by Rhys Rustad-Elliott and Litov Alexander (built Sep  1 2020 10:13:56)
uci
id name Drofa 1.0.0
id authors Rhys Rustad-Elliott and Alexander Litov

option name BookPath type string default book.bin
option name OwnBook type check default false
uciok
ucinewgame
go infinite
HASH_size 10922664
info depth 1 seldepth 1 nodes 45 score cp 53 nps 45000 time 1 pv d2d4
info depth 2 seldepth 2 nodes 158 score cp 0 nps 79000 time 2 pv d2d4 d7d5
info depth 3 seldepth 4 nodes 1228 score cp 29 nps 204666 time 6 pv d2d4 d7d5 g1f3
info depth 4 seldepth 6 nodes 4110 score cp 0 nps 342500 time 12 pv d2d4 d7d5 g1f3 g8f6
info depth 5 seldepth 7 nodes 26093 score cp 28 nps 669051 time 39 pv d2d4 d7d5 g1f3 g8f6 c1f4
info depth 6 seldepth 9 nodes 96208 score cp 10 nps 788590 time 122 pv e2e4 d7d5 f1b5 c8d7 b5d3 g8f6
info depth 7 seldepth 10 nodes 400259 score cp 27 nps 891445 time 449 pv d2d4 d7d5 b1c3 g8f6 c1f4 c8f5 e2e3
info depth 8 seldepth 12 nodes 1483051 score cp 19 nps 913208 time 1624 pv e2e4 e7e6 d2d4 d7d5 b1c3 f8b4 d1f3 b4c3
info depth 9 seldepth 13 nodes 4471078 score cp 22 nps 36199 time 4865 pv b1c3 d7d5 d2d4 e7e6 e2e3 f8b4 c1d2 g8f6 f1d3
info depth 10 seldepth 15 nodes 13851292 score cp 20 nps 61777 time 15643 pv e2e4 e7e5 d2d4 e5d4 d1d4 b8c6 d4c4 g8f6 b1c3 f8d6
info depth 11 seldepth 18 nodes 31394584 score cp 25 nps 38287 time 34732 pv e2e4 d7d5 e4d5 d8d5 b1c3 d5e6 g1e2 e6b6 d2d4 e7e6 c1f4
https://rwbc-chess.de

trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
Gabor Szots
Posts: 1364
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: Drofa 1.0

Post by Gabor Szots »

-flto was a good idea, it increased my compile speed by about 60 %.
Gabor Szots
CCRL testing group
User avatar
Laskos
Posts: 10948
Joined: Wed Jul 26, 2006 10:21 pm
Full name: Kai Laskos

Re: Drofa 1.0

Post by Laskos »

Guenther wrote: Tue Sep 01, 2020 9:52 am
No4b wrote: Mon Aug 31, 2020 10:22 pm
...

Althought after i tried to test windows compilies, they were much slower then ubuntu one
(i suppose Ryzen processor on my Windows PC may be also the reason).
I would appreciate if someone here could test NPS of my thing compared to the VICE on the windows computer with INTEL processor.
Thanks for the release.

For the people who did not find Vice 1.0 for download, just check the XB/UCI chronology ;-)
The given wayback link still has a working Vice 1.0 download link (1.1 will not work there) and it also contains a 64-bit version unlike the 1.1 link from CCW (Norbert).
Vice 1.1 is identical to 1.0 though, except it can use a polyglot book.

I added it only below because of the speed diff.

Thanks Guenther, got it!
Gabor Szots
Posts: 1364
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: Drofa 1.0

Post by Gabor Szots »

Started a gauntlet. Vice included, let's see I can confirm your claim.
Gabor Szots
CCRL testing group