Chess programming Youtube channel: 1+ year summary

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

Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

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

It's been slightly more than a year since Chess Programming YouTube channel has started
https://www.youtube.com/channel/UCB9-pr ... KKqDgXhsMQ
and in this post I'd like to provide a quick summary of what has been done within this year.

The very first series I made was dedicated to a 0x88 based move generator
https://www.youtube.com/watch?v=rrLZVaQ ... 4FZgw5Ior0
it contained 26 videos with a detailed step by step instructions on how to make I guess the simplest
possible array based move generator for a chess engine.

So far so good but it wasn't a full blown engine and since the legendary "chess engine in C" series by
Bluefever Software there were lots of requests for a similar type of tutorials but introducing a bitboard
based move generator, so the next, biggest and currently the most popular series on the channel was
released - I made a "Bitboard chess engine in C" 95 video serious introducing the bitboard move generator
followed by the most commonly used alpha beta search techniques and tapered evaluation allowing to create your own
UCI chess engine absolutely from scratch:
https://www.youtube.com/watch?v=QUNP-Uj ... wfiWNI76Cs

The next thing to consider was creating a series of 12 videos on how to make a web application providing a GUI
to run the newly created chess engine:

At this point I've realized that following such a long series might be a real challenge (despite the fact many guys has
successfully created their own engines based on my tutorials and presented them here on the forum!) and it might be
a good idea to provide a 1 video tutorial on how to create a bare minimum chess program in javascript which was inspired
by the world's smallest programs: Micro-Max by HGM and Toledo chess:


Surprisingly this video was very popular and after some time I decided to simplify the code and create
a "chess engine for absolute beginners" series of only 8 videos. It was live coded in python and was the
compromise between a full blown lengthy series and a minimalist one video crash course:


I've been making lots of stuff apart from the above content, here are just a few more playlists you might
be potentially interested in:

Chess bot (Python + Opencv) to play on any website:
Chess move generator in BASIC for ZX spectrum:
Chinese chess engine:
GUI for Chinese chess engine:

and one of the recent and my favorite - "deobfusctating world's smallest chess program in JavaScript by Oscar Toledo":


There are many more playlists on the channel. You can find them here:
https://www.youtube.com/channel/UCB9-pr ... /playlists

Initially I wasn't going to monetize the channel and wanted to keep it ad free, however the recent YouTube
policy changes spoiled all the videos with ads. This is the reason why I now want to make some income
from the channel - if it's going to have ads anyway then at least I can make it beneficial. All I need to make
that possible is to get ONLY 139 MORE SUBSCRIBERS, so if you like the channel I'm humbly asking you guys to
subscribe to my channel so I could spend more time on bringing new didactic content to the channel.

THANKS IN ADVANCE!
User avatar
mclane
Posts: 18758
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: Chess programming Youtube channel: 1+ year summary

Post by mclane »

Thank you for your great job !
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Chess programming Youtube channel: 1+ year summary

Post by dangi12012 »

You do a great job! I watch regulary.

Would you mind reviewing the currently fastest movegenerator too? I thought long how a movelist really isnt needed if recursive expansion is inlined by a visitor pattern. And I was right - it made the code many times faster.
Comparison with 0x88 or Mailslot would be great. My code is the fastest I could ever make and I wrote dozens of different Array based and others.


I would like to add this quote: "The fastest possible piece of code you can ever write is non existing code. It runs in 0 time and has no overhead. Template metaprogramming and constexpr evaluation in C++ give us these tools."

I really mean that. In many engines I see this very very good tool not utilized at all. Maybe because its relatively new since C++17.

https://www.codeproject.com/Articles/53 ... egenerator
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
oriyonay
Posts: 32
Joined: Tue Jun 01, 2021 5:46 am
Full name: ori yonay

Re: Chess programming Youtube channel: 1+ year summary

Post by oriyonay »

Great job with the videos! They really helped me a whole lot - I'll continue to watch your channel!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

mclane wrote: Thu Oct 07, 2021 7:53 pm Thank you for your great job !
Thank you for your interest!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

dangi12012 wrote: Thu Oct 07, 2021 8:17 pm You do a great job! I watch regulary.

Would you mind reviewing the currently fastest movegenerator too? I thought long how a movelist really isnt needed if recursive expansion is inlined by a visitor pattern. And I was right - it made the code many times faster.
Comparison with 0x88 or Mailslot would be great. My code is the fastest I could ever make and I wrote dozens of different Array based and others.


I would like to add this quote: "The fastest possible piece of code you can ever write is non existing code. It runs in 0 time and has no overhead. Template metaprogramming and constexpr evaluation in C++ give us these tools."

I really mean that. In many engines I see this very very good tool not utilized at all. Maybe because its relatively new since C++17.

https://www.codeproject.com/Articles/53 ... egenerator
Hey, this is really interesting. I'd love to make a review on it.
So hopefully it's coming soon!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

oriyonay wrote: Fri Oct 08, 2021 1:00 am Great job with the videos! They really helped me a whole lot - I'll continue to watch your channel!
Thank you for your kind words!
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

dangi12012 wrote: Thu Oct 07, 2021 8:17 pm You do a great job! I watch regulary.

Would you mind reviewing the currently fastest movegenerator too? I thought long how a movelist really isnt needed if recursive expansion is inlined by a visitor pattern. And I was right - it made the code many times faster.
Comparison with 0x88 or Mailslot would be great. My code is the fastest I could ever make and I wrote dozens of different Array based and others.


I would like to add this quote: "The fastest possible piece of code you can ever write is non existing code. It runs in 0 time and has no overhead. Template metaprogramming and constexpr evaluation in C++ give us these tools."

I really mean that. In many engines I see this very very good tool not utilized at all. Maybe because its relatively new since C++17.

https://www.codeproject.com/Articles/53 ... egenerator
I got an issue running the code - I'm on linux and using the build from the latest release but when I run it I'm getting an error: "Illegal instruction (core dumped)" which I believe happens because of involving some x86 instructions my laptop's processor simply doesn't support.

Is there a way to build it on linux?
I mean it's a visual studio project...
Could you please make a makefile so I could compile?
And from the purist's perspective it would also be more interesting to test the pure software implementation without involving fancy modern hardware
accelerations, does the engine have an option to be compiled for older processors? (Like Stockfish standard or something)
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Chess programming Youtube channel: 1+ year summary

Post by dangi12012 »

maksimKorzh wrote: Sat Oct 09, 2021 9:51 am
dangi12012 wrote: Thu Oct 07, 2021 8:17 pm You do a great job! I watch regulary.

Would you mind reviewing the currently fastest movegenerator too? I thought long how a movelist really isnt needed if recursive expansion is inlined by a visitor pattern. And I was right - it made the code many times faster.
Comparison with 0x88 or Mailslot would be great. My code is the fastest I could ever make and I wrote dozens of different Array based and others.


I would like to add this quote: "The fastest possible piece of code you can ever write is non existing code. It runs in 0 time and has no overhead. Template metaprogramming and constexpr evaluation in C++ give us these tools."

I really mean that. In many engines I see this very very good tool not utilized at all. Maybe because its relatively new since C++17.

https://www.codeproject.com/Articles/53 ... egenerator
I got an issue running the code - I'm on linux and using the build from the latest release but when I run it I'm getting an error: "Illegal instruction (core dumped)" which I believe happens because of involving some x86 instructions my laptop's processor simply doesn't support.

Is there a way to build it on linux?
I mean it's a visual studio project...
Could you please make a makefile so I could compile?
And from the purist's perspective it would also be more interesting to test the pure software implementation without involving fancy modern hardware
accelerations, does the engine have an option to be compiled for older processors? (Like Stockfish standard or something)
1) Yes sure - under linux use: clang-12 -march=native -std=c++20 -lstdc++ -O3 Gigantua.cpp -flto -o giga_clang

2) When _pext_u64 is not available on line 16038 of Movemap.hpp - your compiler will tell you. And you can use

Code: Select all

_ForceInline constexpr uint64_t operator[](const uint64_t blocker) const
{
		if (std::is_constant_evaluated()) {
			return AttackPtr[_pext_u64_emulated(blocker, Mask)];
		}
		else {
			return AttackPtr[_pext_u64(blocker, Mask)];
		}
}
On Zen1, very old Intel - Replace all code by by: return AttackPtr[_pext_u64_emulated(blocker, Mask)];

My Movegenerator already sparked interest with the stockfish developers as their current movegen in SF 14 uses 30% of cpu time.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming Youtube channel: 1+ year summary

Post by maksimKorzh »

dangi12012 wrote: Sat Oct 09, 2021 11:26 am
maksimKorzh wrote: Sat Oct 09, 2021 9:51 am
dangi12012 wrote: Thu Oct 07, 2021 8:17 pm You do a great job! I watch regulary.

Would you mind reviewing the currently fastest movegenerator too? I thought long how a movelist really isnt needed if recursive expansion is inlined by a visitor pattern. And I was right - it made the code many times faster.
Comparison with 0x88 or Mailslot would be great. My code is the fastest I could ever make and I wrote dozens of different Array based and others.


I would like to add this quote: "The fastest possible piece of code you can ever write is non existing code. It runs in 0 time and has no overhead. Template metaprogramming and constexpr evaluation in C++ give us these tools."

I really mean that. In many engines I see this very very good tool not utilized at all. Maybe because its relatively new since C++17.

https://www.codeproject.com/Articles/53 ... egenerator
I got an issue running the code - I'm on linux and using the build from the latest release but when I run it I'm getting an error: "Illegal instruction (core dumped)" which I believe happens because of involving some x86 instructions my laptop's processor simply doesn't support.

Is there a way to build it on linux?
I mean it's a visual studio project...
Could you please make a makefile so I could compile?
And from the purist's perspective it would also be more interesting to test the pure software implementation without involving fancy modern hardware
accelerations, does the engine have an option to be compiled for older processors? (Like Stockfish standard or something)
1) Yes sure - under linux use: clang-12 -march=native -std=c++20 -lstdc++ -O3 Gigantua.cpp -flto -o giga_clang

2) When _pext_u64 is not available on line 16038 of Movemap.hpp - your compiler will tell you. And you can use

Code: Select all

_ForceInline constexpr uint64_t operator[](const uint64_t blocker) const
{
		if (std::is_constant_evaluated()) {
			return AttackPtr[_pext_u64_emulated(blocker, Mask)];
		}
		else {
			return AttackPtr[_pext_u64(blocker, Mask)];
		}
}
On Zen1, very old Intel - Replace all code by by: return AttackPtr[_pext_u64_emulated(blocker, Mask)];

My Movegenerator already sparked interest with the stockfish developers as their current movegen in SF 14 uses 30% of cpu time.
Thank you, I'll try to build it.
Any chances to build with gcc?
But surely I can install clang)