BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

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

Moderators: hgm, Rebel, chrisw

User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

Hey what's up guys, Code Monkey King's here.

It's been a while since BBC chess engine development has started (since Aug 22, 2020 it's almost 2 month ago!) and today I'm happy to introduce the
FINAL ULTIMATE RELEASE of BBC chess engine!

For those of you who is not aware the idea behind creating this engine was following: create a relatively strong chess engine involving modern search tecniques that would be stronger than TSCP and VICE and would be implemented THE SIMPLEST WAY EVER POSSIBLE so EVEN NOOB LIKE ME would be able to understand HOW MODERN CHESS ENGINES WORK and replicate the working version on his own. Now let's have a quick look of what was done within these last 2 months.

SUMMARY:
1. 95 video YouTube series on how to create a bitboard chess engine (from blank file to embedding Stockfish NNUE!)


2. 12 video Youtube series on how to create a website to play versus UCI chess engine ONLINE!


3. 8 video Youtube series on how to embed Stockfish NNUE to whatever chess engine (using NNUE probe library by Daniel Shawul)


4. BONUS VIDEO on how to embed Stockfish NNUE to legendary VICE chess engine by Richard Albert aka Bluefever Software


BBC 1.4 + Stockfish NNUE FINAL RELEASE:
https://github.com/maksimKorzh/bbc/releases/tag/1.4

SOURCE CODE:
https://github.com/maksimKorzh/bbc

FEATURES:
  • own online GUI
  • bitboard board representation
  • pre-calculated attack tables
  • magic bitboards for sliding pieces
  • encoding moves as integers
  • copy/make approach for making moves
  • negamax search with alpha beta pruning
  • PV/killer/history move ordering
  • iterative deepening
  • PVS (Principle Variation Search)
  • LMR (Late Move Reduction)
  • NMP (Null Move Pruning)
  • razoring
  • evaluation pruning / static null move pruning
  • Transposition table (up to 128MB)
  • PURE Stockfish NNUE evaluation + 50 move rule penalty
  • UCI protocol
CREDITS:
This project would never be completed
without the help of Talk Chess forum
community members who has been helping me
during the development process significantly
I would like to thank to:
  • HaraldLuessen & Pedro Castro Elgarresta for neverending hints and technical support
  • Sven Schüle for explaining how mating scores works in TT (in great details!)
  • Jay Warendorff for testing development versions of BBC
  • Marcel Vanthoor for teaching me linear algebra and general inspirations
  • Ronald Friederich for providing PeSTO evaluation tables and sharing his ideas
  • Gabor Szots and Silvian R. from CCRL for testing & rating BBC
  • Chris Rea for testing and fixing bugs
  • Brendan J. Norman for creating logo for BBC
  • Daniel Shawul for providing NNUE probe library
And all the subscribers watching my videos and
motivating me to keep the development!

STRENGTH & TESTING:
According to latest tests by Silvian R. BBC 1.4 + Stockfish NNUE should be around 2750 Elo
http://talkchess.com/forum3/viewtopic.php?f=6&t=75536

Without NNUE and with handcrafted eval that I've dropped completely the biggest CCRL rating was 2096
Which means that Stockfish NNUE itself gave 600+ Elo points...

CCRL TESTING REQUEST:
Not for myself but for my YouTube subscribers please rate the FINAL VERSION
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by Gabor Szots »

maksimKorzh wrote: Sun Oct 25, 2020 10:54 pm
  • Gabor Szots and Silvian R. from CCRL for testing & rating BBC
Silvian is, unfortunately, not a CCRL member.
Gabor Szots
CCRL testing group
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

Gabor Szots wrote: Mon Oct 26, 2020 8:15 am
maksimKorzh wrote: Sun Oct 25, 2020 10:54 pm
  • Gabor Szots and Silvian R. from CCRL for testing & rating BBC
Silvian is, unfortunately, not a CCRL member.
Yeah, I already know... I'll fix that in readme file.
User avatar
Guenther
Posts: 4606
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by Guenther »

maksimKorzh wrote: Sun Oct 25, 2020 10:54 pm Hey what's up guys, Code Monkey King's here.

It's been a while since BBC chess engine development has started (since Aug 22, 2020 it's almost 2 month ago!) and today I'm happy to introduce the
FINAL ULTIMATE RELEASE of BBC chess engine!

For those of you who is not aware the idea behind creating this engine was following: create a relatively strong chess engine involving modern search tecniques that would be stronger than TSCP and VICE and would be implemented THE SIMPLEST WAY EVER POSSIBLE so EVEN NOOB LIKE ME would be able to understand HOW MODERN CHESS ENGINES WORK and replicate the working version on his own. Now let's have a quick look of what was done within these last 2 months.

...

BBC 1.4 + Stockfish NNUE FINAL RELEASE:
https://github.com/maksimKorzh/bbc/releases/tag/1.4

...
Just for clarification (mostly for the 'general' user), BBC 1.2 was the last version able to play
reasonable chess w/o the SF-NNUE?

I know you completely stripped off all previous eval after BBC 1.2, thus it's the time now for me to decide
what to do with all NNUE entries in the XB/UCI chronology and also for checking, if releases are capable at all to
play with and w/o NNUE
.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

Guenther wrote: Mon Oct 26, 2020 9:24 am
maksimKorzh wrote: Sun Oct 25, 2020 10:54 pm Hey what's up guys, Code Monkey King's here.

It's been a while since BBC chess engine development has started (since Aug 22, 2020 it's almost 2 month ago!) and today I'm happy to introduce the
FINAL ULTIMATE RELEASE of BBC chess engine!

For those of you who is not aware the idea behind creating this engine was following: create a relatively strong chess engine involving modern search tecniques that would be stronger than TSCP and VICE and would be implemented THE SIMPLEST WAY EVER POSSIBLE so EVEN NOOB LIKE ME would be able to understand HOW MODERN CHESS ENGINES WORK and replicate the working version on his own. Now let's have a quick look of what was done within these last 2 months.

...

BBC 1.4 + Stockfish NNUE FINAL RELEASE:
https://github.com/maksimKorzh/bbc/releases/tag/1.4

...
Just for clarification (mostly for the 'general' user), BBC 1.2 was the last version able to play
reasonable chess w/o the SF-NNUE?

I know you completely stripped off all previous eval after BBC 1.2, thus it's the time now for me to decide
what to do with all NNUE entries in the XB/UCI chronology and also for checking, if releases are capable at all to
play with and w/o NNUE
.
Thanks for a good question.
It's a bit complicated to explin but I'll try)

So...

BBC 1.2 is indeed the last version able to play reasonable chess without NNUE
BUT BBC 1.2 is almost 100 Elo points weaker than BBC 1.1 and you might wonder what a hack...
Try to explain: BBC 1.1 uses material + PST only (for opening and endgame, values are taken from PeSTO engine). This version already has a dynamic hash allocation and tapered evaluation, so in the middlegame phase the scores are interpolated.

BBC 1.2 apart from material and PST tables implements some very basic pawn evaluation (doubled/passed/isolated), knows about open and semi-open files, tries to maintain pawn/piece shield around the king, calculates mobility for bishops and queens (inspired by Fruit)
BUT due to the fact the values for bonuses/penalties are taken from other engines and DOES NOT match the PeSTO values it results almost 100 Elo points worse play. So it NEEDS LOTS OF TUNING to play stronger than version 1.1.

Now due to my dumbness I didn't manage to master Texel's tuning (rocket science to me) hence version 1,2 left weaker than version 1.1 - such an irony...

With a proper tuning version 1.2 should play atound 2150.

Anyway strongest non nnue version is still BBC 1.1 which is rated 2096 in BLITZ at CCRL by Gabor Shotz.

Overall BBC offers HUGE HIGHWAYS for improvements, just to give you an idea what can be upgraded to give it at least extra 200 points (without touching evaluation):

1. Use make_move/take_back approach instead of copy/make
2. Score moves in move generator, instead of doing it separately of movegen and directly in search
3. Order moves on the fly in negamax instead of doing it before iteration over moves
4. Tune search extensions and pruning margins for LMR
5. Upgrade transposition table from always replace to somewhat more complicated schema
6. etc.

But even though with these improvements it would definitely start playing stronger, still it makes no sense to me at all because it would go for traditional monolithic-optimized approach and loose it's original modular charm when you can add/remove parts of code without harming engine.
BBC was intended as "lego" engine (you know that LEGO pieces to build anything...) so the user can explore each part separately, outside of the engine context.

Hope the above answers the question, please ask more if not - I'll be happy to explain more.
Thanks for your interest to BBC!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

Gabor Szots wrote: Mon Oct 26, 2020 8:15 am
maksimKorzh wrote: Sun Oct 25, 2020 10:54 pm
  • Gabor Szots and Silvian R. from CCRL for testing & rating BBC
Silvian is, unfortunately, not a CCRL member.
And yeah - he SHOULD BE for he's doing a GREAT JOB!
Gabor Szots
Posts: 1362
Joined: Sat Jul 21, 2018 7:43 am
Location: Szentendre, Hungary
Full name: Gabor Szots

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by Gabor Szots »

maksimKorzh wrote: Mon Oct 26, 2020 2:20 pm Anyway strongest non nnue version is still BBC 1.1 which is rated 2096 in BLITZ at CCRL by Gabor Shotz.
New CCRL member?
Gabor Szots
CCRL testing group
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

Gabor Szots wrote: Mon Oct 26, 2020 6:11 pm
maksimKorzh wrote: Mon Oct 26, 2020 2:20 pm Anyway strongest non nnue version is still BBC 1.1 which is rated 2096 in BLITZ at CCRL by Gabor Shotz.
New CCRL member?
Oh, Gabor, I'm so sorry for misspelling your last name, so sorry! Obviously I meant Szots, 1000 apologies!
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by mvanthoor »

Thanks for the credits, Maksim :)

Personally I think it's a pity you took the 'easy way out' by just slapping NNUE on top of your search.

Rustic is now starting to play, and it is very fast. It reaches depths -without- a hash table and without killers/heuristics, that some engine in its current Elo-range (~1700 - 1750 CCRL) only reach -with- a transposition table and -with- heuristics. I wonder what the search depths will be when I add those functions. If I should slap a NNUE on top of that, I could end up with a 3000+ Elo engine almost overnight... but I don't want to. I like Rustic's current playing style, and I'm going to create it by hand, value by value, using testing games, inteded to play against, in combination with a level function. I may add a tuned evaluation later, as an alternative for engine testing.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: BBC 1.4 + Stockfish NNUE + Online GUI + Opening book - FINAL RELEASE!

Post by maksimKorzh »

mvanthoor wrote: Mon Oct 26, 2020 8:21 pm Thanks for the credits, Maksim :)

Personally I think it's a pity you took the 'easy way out' by just slapping NNUE on top of your search.

Rustic is now starting to play, and it is very fast. It reaches depths -without- a hash table and without killers/heuristics, that some engine in its current Elo-range (~1700 - 1750 CCRL) only reach -with- a transposition table and -with- heuristics. I wonder what the search depths will be when I add those functions. If I should slap a NNUE on top of that, I could end up with a 3000+ Elo engine almost overnight... but I don't want to. I like Rustic's current playing style, and I'm going to create it by hand, value by value, using testing games, inteded to play against, in combination with a level function. I may add a tuned evaluation later, as an alternative for engine testing.
Hi Marcel, thank you for teaching me linear algebra)
Btw I'm now studying neural networks (from the very very basics) to may be make my own one day (maybe in other life)

And regarding "easy way out" - don't take it too series) BBC is a YouTube coding project. It's not a "real" chess engine from the perspective like if I wanted to make a chess engine for my self. I wanted to show people what kind of opportunities are available nowadays and hopefully I did. If you were doing youtube you would probably realize that the stuff to emphasize is way different compared to say your scientific approach. Let me try to explain this:

In my understanding (obtained from walking through Rustic's code) I can conclude that it's an example of what SOLID PROGRAMMER with YEARS OF PRODUCTION EXPERIENCE can do if applies his skills to chess programming hobby. That it incredibly cool and would be incredibly valuable/influential to the community whey you'll finish it (well at least first official release). But for me as a noob - what I can say - that is something that I can only realize how cool it is but I can't/won't make use of it because in order to understand all the details behind it's architecture I need to have not only greater skills but... I just had to born in different body with different consciousness and live completely different life compared to what I lived until today - I would need to have classical solid education like you have instead of being 100% self-learner (I have never ever graduate from any kind of programming courses, all I know and can do is from YouTube and studying documentation, I didn't even read books... well, almost didn't). More over that people like you in terms skills and approach are THE VAST MAJORITY of programmers and I will be proud to know another guy who would one day stay along with HGM, Bob Hyatt, Tord Romstad etc... But the problem is that in most cases (your case is probably the only fantastic extension!) GURUS can't help NOOBS. It's like I'm asking in tech room something about alpha-beta search and HGM starts explaining some rocket science that I would never probably be able to understand while enough answer would be just to tell the difference between fail-high and fail-low nodes))) And it happens in everything. Quite a fun thinf that when I've started my series - Pedro and Harald started teaching me in the appropriate way (the only acceptable due to my dumbness) !!!

Now on the other hand there many guys like me, and btw I'm chatting with them in youtube comments - and I'm telling like: "why don't you go to talk chess and ask some questions there" - and the answer is something like: "no, no, that's too complicated...". When I was at school I HATED all math related subjects because the way they taught assumed that one has a specific... I don't know... brain type? consciousness type? understanding type? which I never had. Just to give an example - I remember I was taught to multiply matrices... I didn't understand ANYTHING and the biggest question was: "WHY THE HELL DO I NEED TO DO THAT???" and I failed all possible exams and being discriminated by the teachers. Now yesterday I was watching "gentle intro to neural networks" by Bluefever Software (author of VICE!) and OMG! He did explain it so damn good that I fell in love with matrix multiplication! As far python numpy lib allows to do that automatically I don't really need to do that by hands, but now I have a desire t learn multiplying those matrices believe it or not! If I watched that tutorial when I was at school (it obviously didn't exist that long time ago) my life could be different.

But I never complain and think that the life I live is the best possible because it is my life. So my job now is to help people like me to master relatively complicated subjects, like chess engines in the easiest way possible. Recently I got a comment on youtube from one of my subscribers (yodatk his nickname) - he said: "thanks to your series I've finally finished my engine which I couldn't do for years". Can you imagine? I was there as well. Before making my C programming skills good enough to understand Bluefever's series on VICE (it was a challange for me btw) I tried to complete move generator in javascript for 3 years!!! and I couldn't! And if I can hardly understand talkchess answers now - imagine what a rocket science it would have been for me in that time. But then thought: ok, I will master pointers in C (I started bluefever's C programming playlist) and then get back to his engine series.

There might be LOTS of examples but the gist is like someone said: IF YOU THINK YOU'RE UNDERSTANDING SOMETHING THEN TRY TO EXPLAIN IT TO 5 YEAR OLD KID AND IF HE UNDERSTANDS THAT WOULD MEAN THAT YOU'RE REALLY UNDERSTANDING WHAT ARE YOU TALKING ABOUT. Now I'm trying to go even further - same stuff but imagine that 5 year old kid is not a human but a monkey. That's how I felt when was a kid or even at high school.

So you just imagine that yet another code monkey like me would be able to TOUCH nnue technology! This is so exciting! You can always go deeper if it's your goal. It's just not my goal, for my goal is to show the approach, path to walk through. highlight the most important things and tell about pitfalls.
This is not "teaching" like they teach in universities, no, it's like: "hey what's up guys, I'm as noob as you but I've just found a way of how to embedd stockfish nnue to a chess engine, are you with me?"

This is what I'm doing)
Thanks for taking time to read!