New open-source engine, Bit-Genie

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

Moderator: Ras

aryan1508
Posts: 31
Joined: Sat Mar 20, 2021 3:44 pm
Full name: Aryan Parekh

New open-source engine, Bit-Genie

Post by aryan1508 »

Hey everyone! Hope you all are doing well.

A while back I decided to merge my love for chess and computers. No harm to start a new project is it? Fast forward a few months and I can't spend a day without doing something related to it :o . I have tried my best to keep the code simple. Here is what I've managed to do so far :D

https://github.com/Aryan1508/Bit-Genie

I am glad to be able to share my work this way. Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Guenther
Posts: 4718
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New open-source engine, Bit-Genie

Post by Guenther »

aryan1508 wrote: Sun Mar 21, 2021 3:43 pm Hey everyone! Hope you all are doing well.

A while back I decided to merge my love for chess and computers. No harm to start a new project is it? Fast forward a few months and I can't spend a day without doing something related to it :o . I have tried my best to keep the code simple. Here is what I've managed to do so far :D

https://github.com/Aryan1508/Bit-Genie

I am glad to be able to share my work this way. Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Thanks for the release Aryan and welcome here!

Here is a result from a testmatch with a slightly earlier compilation (game playing code not changed since then)
played between yesterday and the day before...
This was with 40moves /120s and both around 32MB hash.

Code: Select all

Score of Rustic_Alpha2-64 vs Bit-Genie_r107-64: 93 - 74 - 33 [0.547]
...      Rustic_Alpha2-64 playing White: 43 - 34 - 23  [0.545] 100
...      Rustic_Alpha2-64 playing Black: 50 - 40 - 10  [0.550] 100
...      White vs Black: 83 - 84 - 33  [0.497] 200
Elo difference: 33.1 +/- 44.3, LOS: 92.9 %, DrawRatio: 16.5 %
200 of 200 games finished.

Player: Rustic_Alpha2-64
   "Draw by 3-fold repetition": 10
   "Draw by adjudication": 6
   "Draw by fifty moves rule": 7
   "Draw by insufficient mating material": 8
   "Draw by stalemate": 2
   "Loss: Black mates": 34
   "Loss: White mates": 40
   "Win: Black mates": 49
   "Win: Black wins by adjudication: user decision": 1
   "Win: White mates": 43
Player: Bit-Genie_r107-64
   "Draw by 3-fold repetition": 10
   "Draw by adjudication": 6
   "Draw by fifty moves rule": 7
   "Draw by insufficient mating material": 8
   "Draw by stalemate": 2
   "Loss: Black mates": 49
   "Loss: Black wins by adjudication: user decision": 1
   "Loss: White mates": 43
   "Win: Black mates": 34
   "Win: White mates": 40
https://rwbc-chess.de

[Trolls n'existent pas...]
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New open-source engine, Bit-Genie

Post by mvanthoor »

aryan1508 wrote: Sun Mar 21, 2021 3:43 pm Hey everyone! Hope you all are doing well.

A while back I decided to merge my love for chess and computers. No harm to start a new project is it? Fast forward a few months and I can't spend a day without doing something related to it :o . I have tried my best to keep the code simple. Here is what I've managed to do so far :D

https://github.com/Aryan1508/Bit-Genie

I am glad to be able to share my work this way. Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Hi, and welcome.
Guenther wrote: Sun Mar 21, 2021 5:29 pm Thanks for the release Aryan and welcome here!

Here is a result from a testmatch with a slightly earlier compilation (game playing code not changed since then)
played between yesterday and the day before...
This was with 40moves /120s and both around 32MB hash.

Code: Select all

Score of Rustic_Alpha2-64 vs Bit-Genie_r107-64: 93 - 74 - 33 [0.547]
...      Rustic_Alpha2-64 playing White: 43 - 34 - 23  [0.545] 100
...      Rustic_Alpha2-64 playing Black: 50 - 40 - 10  [0.550] 100
...      White vs Black: 83 - 84 - 33  [0.497] 200
Elo difference: 33.1 +/- 44.3, LOS: 92.9 %, DrawRatio: 16.5 %
200 of 200 games finished.
What did you change in this match, since the other match you ran between Rustic and Bit-Genie? In the other match, the result was much more in Rustic's favor:

http://talkchess.com/forum3/viewtopic.p ... 60#p887517

There, Rustic Alpha 2 scored 66%, in the run above, it scored 54%.

As you ran 200 games, I assume Bit-Genie is stable. It would be good to have another stable engine in this range. I'll run a test myself overnight.
Last edited by mvanthoor on Sun Mar 21, 2021 6:22 pm, edited 2 times in total.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Guenther
Posts: 4718
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New open-source engine, Bit-Genie

Post by Guenther »

mvanthoor wrote: Sun Mar 21, 2021 6:11 pm
aryan1508 wrote: Sun Mar 21, 2021 3:43 pm Hey everyone! Hope you all are doing well.

A while back I decided to merge my love for chess and computers. No harm to start a new project is it? Fast forward a few months and I can't spend a day without doing something related to it :o . I have tried my best to keep the code simple. Here is what I've managed to do so far :D

https://github.com/Aryan1508/Bit-Genie

I am glad to be able to share my work this way. Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Hi, and welcome.
Guenther wrote: Sun Mar 21, 2021 5:29 pm Thanks for the release Aryan and welcome here!

Here is a result from a testmatch with a slightly earlier compilation (game playing code not changed since then)
played between yesterday and the day before...
This was with 40moves /120s and both around 32MB hash.

Code: Select all

Score of Rustic_Alpha2-64 vs Bit-Genie_r107-64: 93 - 74 - 33 [0.547]
...      Rustic_Alpha2-64 playing White: 43 - 34 - 23  [0.545] 100
...      Rustic_Alpha2-64 playing Black: 50 - 40 - 10  [0.550] 100
...      White vs Black: 83 - 84 - 33  [0.497] 200
Elo difference: 33.1 +/- 44.3, LOS: 92.9 %, DrawRatio: 16.5 %
200 of 200 games finished.
What did you change in this match, since the other match you ran between Rustic and Bit-Genie? In the other match, the result was much more in Rustic's favor:

http://talkchess.com/forum3/viewtopic.p ... 60#p887517

There, Rustic Alpha 2 scored 66%, in the run above, it scored 54%.

As you ran 200 games, I assume Bit-Genie is stable. It would be good to have another stable engine in this range. I'll run a test myself overnight.

PS: I expect Rustic Alpha 2 to score around 1840 on CCRL Blitz. That would put Bit-Genie at just over 1800.
It's the from the same match, the previous result just had more statistical noise, Marcel.
(I can make the games available if you want)
https://rwbc-chess.de

[Trolls n'existent pas...]
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New open-source engine, Bit-Genie

Post by mvanthoor »

Guenther wrote: Sun Mar 21, 2021 6:15 pm It's the from the same match, the previous result just had more statistical noise, Marcel.
(I can make the games available if you want)
Ah, good.

I expect Rustic Alpha 2 to score around 1840 on CCRL Blitz. That would put Bit-Genie at 1805. (Obviously a 200 game test against one engine is a bit tentative.)

What features does Bit-Genie have now?

I did a cursory scan of the evaluation and saw it has a tuned (but not tapered tapered?) evaluation, double, passed, isolated pawn recognition, rooks on open and semi-open files files and mobility... Rustic doesn't have any of that yet. If Bit-Genie has more search/move ordering features than MVV-LVA / Hash Move sorting and a transposition table, in combination with that evaluation, it should be much stronger than Rustic Alpha 2.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
aryan1508
Posts: 31
Joined: Sat Mar 20, 2021 3:44 pm
Full name: Aryan Parekh

Re: New open-source engine, Bit-Genie

Post by aryan1508 »

I use staged move generation in my program. So after the Hash move, noisy moves are ordered using SEE (not mvv-lva). I was testing earlier and forgot to remove the mvv-lva score array :D. Other than that killer and history heuristic is used. The tt implementation right now is pretty simple, every entry only contains a move and the hash.
Guenther
Posts: 4718
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: New open-source engine, Bit-Genie

Post by Guenther »

mvanthoor wrote: Sun Mar 21, 2021 6:24 pm
Guenther wrote: Sun Mar 21, 2021 6:15 pm It's the from the same match, the previous result just had more statistical noise, Marcel.
(I can make the games available if you want)
Ah, good.

I expect Rustic Alpha 2 to score around 1840 on CCRL Blitz. That would put Bit-Genie at 1805. (Obviously a 200 game test against one engine is a bit tentative.)
Ah then my estimation of 1850 was slightly overrated, I guessed new Rustic 2 about 1880 for CCRl Blitz from your posts ;-)
A new currently running testmatch vs. Loki 1.20 seems to confirm this - standing now 55:50 for Loki which has an intermediate rating of 1817 at CCRL.

(For the features Aryan told himself, it also seems quite fast in nps, IIRC)
https://rwbc-chess.de

[Trolls n'existent pas...]
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: New open-source engine, Bit-Genie

Post by mvanthoor »

Guenther wrote: Sun Mar 21, 2021 7:15 pm Ah then my estimation of 1850 was slightly overrated, I guessed new Rustic 2 about 1880 for CCRl Blitz from your posts ;-)
A new currently running testmatch vs. Loki 1.20 seems to confirm this - standing now 55:50 for Loki which has an intermediate rating of 1817 at CCRL.
It depends on the engines you test against. Rustic's performance against some engines is up to 1880 Elo indeed, but against some other engines, it's "just" 1820. I test in gauntlets against 10-15 other engines, and I calibrate the list against Alpha 1's rating, which is 1677. In those tests, Rustic sits at 1840-1850.

Obviously I don't know which engines CCRL is going to use, or which opening book, or which version of the executable (I _hope_ they don't use the 32-bit one, because Rustic makes _absolutely no provisions_ for 32-bit systems. It's a 64-bit engine from the ground up, and it just so happens to compile and work as a 32-bit engine too, and that's that.)
(For the features Aryan told himself, it also seems quite fast in nps, IIRC)
I'll have to look it up then.

Thomas (Lithander of MinimalChess) provided me with a private compile of MinimalChess 0.3, where he implemented the PeSTO PST's and tapered evaluation; this increased MinimalChess' rating from 1570 to +/- 1780. That is about +100 over Rustic Alpha 1 (similar feature set to MinimalChess); it's just 60-70 Elo short of Alpha 2, which already has a hash table.

Therefore, I expect a tuned and tapered evaluation to gain about 200 points, when replacing a standard evaluation with hand-written PST's.

That is what I meant: if Bit-Genie already has a tuned (and maybe tapered) evaluation, and many more other evaluation terms, I'd believe it should be on par with Rustic Alpha 2, at the least. MinimalChess 0.3 with PeSTO falls short by just 70 Elo, but it doesn't have a hash table yet. Adding this should add another 170 Elo. Thus... a basic engine with MVV-LVA, TT, TTMove ordering, and a tapered and tuned evaluation, could be around 1950 Elo.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
Ras
Posts: 2730
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: New open-source engine, Bit-Genie

Post by Ras »

aryan1508 wrote: Sun Mar 21, 2021 3:43 pmFast forward a few months and I can't spend a day without doing something related to it :o .
Haha yes, welcome to the chess programming addiction! :D
Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Nice little engine! It even works under Linux, although in main.cpp, "io.h" is not found - but it doesn't seem to do anything so that I just deleted that.

Some observations:

The UCI implementation needs a redesign because "isready", "stop", and "quit" need to be processed even during search.

I noticed that the FEN position parser will crash if you don't give the move counters.

In uciparse.cpp, I think there should be an "else" between lines 189/191 because otherwise, line 191 may access a moved variable (token may have been moved in the "name" branch).

There were some compiler warnings for printf types:

Code: Select all

src/tt.cpp: In member function ‘void TTable::resize(int)’:
src/tt.cpp:34:49: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘std::vector<TEntry>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   34 |  printf("Hash table initialized with %d Mb ( %llu entries )\n", mb, entries.size());
      |                                              ~~~^                   ~~~~~~~~~~~~~~
      |                                                 |                               |
      |                                                 long long unsigned int          std::vector<TEntry>::size_type {aka long unsigned int}
      |                                              %lu


src/search.cpp: In function ‘void {anonymous}::print_info_string(Position&, {anonymous}::SearchResult&, TTable&, Search&, int)’:
src/search.cpp:254:51: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  254 |   std::printf("info depth %d seldepth %d nodes %llu score %s time %lld pv ",
      |                                                ~~~^
      |                                                   |
      |                                                   long long unsigned int
      |                                                %lu
......
  257 |      search.info.nodes,
      |      ~~~~~~~~~~~~~~~~~                             
      |                  |
      |                  uint64_t {aka long unsigned int}

src/search.cpp:254:70: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘std::chrono::duration<long int, std::ratio<1, 1000> >::rep’ {aka ‘long int’} [-Wformat=]
  254 |   std::printf("info depth %d seldepth %d nodes %llu score %s time %lld pv ",
      |                                                                   ~~~^
      |                                                                      |
      |                                                                      long long int
      |                                                                   %ld
......
  259 |      duration_cast<milliseconds>(search.limits.stopwatch.elapsed_time()).count());
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                               |
      |                                                                               std::chrono::duration<long int, std::ratio<1, 1000> >::rep {aka long int}
The problem is that under 64 bit Linux, "long unsigned int" is already a 64 bit type while it would be only 32 bit under 64 bit Windows. You can either just cast them upwards in the printf call, to "long long unsigned" / "long long int", or you avoid printf at all and use the streams like in most other places of the engine.
Rasmus Althoff
https://www.ct800.net
aryan1508
Posts: 31
Joined: Sat Mar 20, 2021 3:44 pm
Full name: Aryan Parekh

Re: New open-source engine, Bit-Genie

Post by aryan1508 »

Ras wrote: Sun Mar 21, 2021 8:27 pm
aryan1508 wrote: Sun Mar 21, 2021 3:43 pmFast forward a few months and I can't spend a day without doing something related to it :o .
Haha yes, welcome to the chess programming addiction! :D
Feel free to criticize/compliment it, I really wanna hear what others think of it :)
Nice little engine! It even works under Linux, although in main.cpp, "io.h" is not found - but it doesn't seem to do anything so that I just deleted that.

Some observations:

The UCI implementation needs a redesign because "isready", "stop", and "quit" need to be processed even during search.

I noticed that the FEN position parser will crash if you don't give the move counters.

In uciparse.cpp, I think there should be an "else" between lines 189/191 because otherwise, line 191 may access a moved variable (token may have been moved in the "name" branch).

There were some compiler warnings for printf types:

Code: Select all

src/tt.cpp: In member function ‘void TTable::resize(int)’:
src/tt.cpp:34:49: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘std::vector<TEntry>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   34 |  printf("Hash table initialized with %d Mb ( %llu entries )\n", mb, entries.size());
      |                                              ~~~^                   ~~~~~~~~~~~~~~
      |                                                 |                               |
      |                                                 long long unsigned int          std::vector<TEntry>::size_type {aka long unsigned int}
      |                                              %lu


src/search.cpp: In function ‘void {anonymous}::print_info_string(Position&, {anonymous}::SearchResult&, TTable&, Search&, int)’:
src/search.cpp:254:51: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  254 |   std::printf("info depth %d seldepth %d nodes %llu score %s time %lld pv ",
      |                                                ~~~^
      |                                                   |
      |                                                   long long unsigned int
      |                                                %lu
......
  257 |      search.info.nodes,
      |      ~~~~~~~~~~~~~~~~~                             
      |                  |
      |                  uint64_t {aka long unsigned int}

src/search.cpp:254:70: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘std::chrono::duration<long int, std::ratio<1, 1000> >::rep’ {aka ‘long int’} [-Wformat=]
  254 |   std::printf("info depth %d seldepth %d nodes %llu score %s time %lld pv ",
      |                                                                   ~~~^
      |                                                                      |
      |                                                                      long long int
      |                                                                   %ld
......
  259 |      duration_cast<milliseconds>(search.limits.stopwatch.elapsed_time()).count());
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                               |
      |                                                                               std::chrono::duration<long int, std::ratio<1, 1000> >::rep {aka long int}
The problem is that under 64 bit Linux, "long unsigned int" is already a 64 bit type while it would be only 32 bit under 64 bit Windows. You can either just cast them upwards in the printf call, to "long long unsigned" / "long long int", or you avoid printf at all and use the streams like in most other places of the engine.
Oh sorry I should've checked for all this before announcing it :(. I'll surely fix the warning and the error in main.cpp.

About the stop and quit command, I have to do a little bit of research for it. The best solution right now seems to run search on another thread.