Chess programming on YouTube: NOBODY CARES?

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

Re: Chess programming on YouTube: NOBODY CARES?

Post by maksimKorzh »

towforce wrote: Sun Aug 23, 2020 9:13 am My suggestion: maybe the chess programming YouTube home page could prompt viewers to start with an overview video which shows how all the parts fit together to make a whole.

Reading this thread has prompted me to think about what computer chess is all about: for me, it was always a gateway/insight into AI, but now I think it's not that at all for most of us. For the majority here, computer chess is a new type of chess for modern times, and the OP of this thread wants to be a YouTube coach for this new game.
My suggestion: maybe the chess programming YouTube home page could prompt viewers to start with an overview video which shows how all the parts fit together to make a whole.
Interesting suggestion, I was thinking about it as well, but didn't yet come up with a proper decision because the target auditory has just started getting clear. I mean those having experience creating their own engines already know that while those who either don't know this or not the part of this forum DOESN'T CARE in most cases (hence the title of this thread) - I mean before opening this thread I head only a few subscribers from my other YT channel not related to chess programming. Well, may be my assumption was wrong though. Also I don't feel like I'm good at explaining theory... Anyway, thanks for your suggestion, maybe one day... who knows.
Reading this thread has prompted me to think about what computer chess is all about: for me, it was always a gateway/insight into AI, but now I think it's not that at all for most of us. For the majority here, computer chess is a new type of chess for modern times, and the OP of this thread wants to be a YouTube coach for this new game.
I think it's very personal. For example for me chess programming is the matter of self research and making videos is the way to gain a fair evaluation of my current skills/understanding (both very basic IMO). I'm not intending to be a coach, it's more like to get surrounded by like minded people and grow together. I mean the format of tutorials sometimes fools people in terms of an illusion like the author wants to teach, not at all in my case. For me it's the pure matter of making the topic easy to try on your own for everyone.

And one last important thing regarding the reason of doing this exactly on YouTube:
I'm asking questions in the tech discussions room on this forum from time to time when get stuck and the problem is...
Well, let be better explain this on example: ones I head an alpha-beta related question, but my understanding was so weird and poor that even AFTER GETTING full page sized answers FROM GURUS LIKE HGM I was feeling SUCH A NOOB... It feels like: "sir, I deeply appreciate your response, but I need to do chess programming for another 5 years before I'll be ready to ask this question again, sorry for wasting your time...", It's such a weird feeling when you're reading a top level tech consultation that was kindly given to you absolutely for free and you realize that you don't understand 70% of terms being involved in that answer. Obviously later on after rereading the post many many time and googling at the same time you finally realize the brilliancy behind the particular tech solution given to you, but this is SO HARD. And I believe that not many guys have enough time and will to go through this. So I thought if I can cover most basic concepts in my videos it would at least prepare people to start asking decent questions within tech discussions room on this forum.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Chess programming on YouTube: NOBODY CARES?

Post by maksimKorzh »

Bo Persson wrote: Sun Aug 23, 2020 9:42 am
ChessRenewal wrote: Sat Aug 22, 2020 5:10 pm I tried replacing

#ifdef WIN64
#include "windows.h"
#else
#include "sys/time.h"
#include "sys/select.h"
#include "string.h"
#endif

by

#include "windows.h"

Now get:

SeverityCodeDescription StateError C2057 expected constant expression wukong.c line 1466

SeverityCodeDescription StateError C2466 cannot allocate an array of constant size 0 wukong.c line 1466

SeverityCodeDescriptionStateErrorC 2133 'move_scores': unknown size wukong.c line 1466

where Line 1466 is:

int move_scores[move_list->count];

Still get a build failure.
This uses an array with a runtime length (VLA) which was added by C99, but again made optional in C11. (C90 - not present, C99 - required, C11 - optional :shock: )

Microsoft's compiler doesn't specifically support C99, so this feature is not available.

On the other hand, gcc supports it even when it doesn't have to, making it harder to write portable code. :?

https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
Hi Bo!

Thank you so much for pointing out WHY IN PARTICULAR these errors happened. I felt like the reason is most likely related to Microsoft compiler issue, but didn't know for sure because never used it. I've already suggested to use GCC instead and so do you!
User avatar
Bo Persson
Posts: 243
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Chess programming on YouTube: NOBODY CARES?

Post by Bo Persson »

maksimKorzh wrote: Sun Aug 23, 2020 3:09 pm
Bo Persson wrote: Sun Aug 23, 2020 9:42 am
ChessRenewal wrote: Sat Aug 22, 2020 5:10 pm
Now get:

SeverityCodeDescription StateError C2057 expected constant expression wukong.c line 1466

SeverityCodeDescription StateError C2466 cannot allocate an array of constant size 0 wukong.c line 1466

SeverityCodeDescriptionStateErrorC 2133 'move_scores': unknown size wukong.c line 1466

where Line 1466 is:

int move_scores[move_list->count];

Still get a build failure.
This uses an array with a runtime length (VLA) which was added by C99, but again made optional in C11. (C90 - not present, C99 - required, C11 - optional :shock: )

Microsoft's compiler doesn't specifically support C99, so this feature is not available.

On the other hand, gcc supports it even when it doesn't have to, making it harder to write portable code. :?

https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
Hi Bo!

Thank you so much for pointing out WHY IN PARTICULAR these errors happened. I felt like the reason is most likely related to Microsoft compiler issue, but didn't know for sure because never used it. I've already suggested to use GCC instead and so do you!
Just for the record: I definitely recommend using Microsoft's compiler when targeting Windows from a Windows host. It is the system's native compiler after all.

On the other hand, I would also recommend using C++ member functions instead of C functions taking pointers to structs. 8-)
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Chess programming on YouTube: NOBODY CARES?

Post by mvanthoor »

maksimKorzh wrote: Sat Aug 22, 2020 11:53 pm This is great. I'm tempted to follow your series. Hope you'll post it on this forum one day.
Thanks :) I will. At the moment development speed is about as fast as molasses flowing uphill due to:

- Vision problems (hopefully to be resolved next week)
- Me writing in Rust instead of C; I'm still jacking around with the program to get it written in proper "Rust-style" and not in "C-style." (I don't want to write a program that is basically a C program written in Rust syntax.) So I'm often rewriting / changing things.
- Because Rust is so new, I'm sometimes hitting snags, such as a massive slowdown in the latest version of the compiler. I then have to look into that, and either resolve it in my code, or file a bug report.
I'm not a native speaker as well))) And doing videos live without editing, only pausing when stuck and the resume recording.
I've watched some of your first video's on the 0x88 engine.

Your English is very good. It's near-fluent, and easily understood. I love how you say "rewersal" :) It makes me think of Star Trek IV, where Pavel Chekov asks an American navy officer: "Do you know where the nuclear wessels are?" (Where he heavily exaggerates, on purpose, the tendency of Russian speakers to pronounce a V as a W.)

You don't have to be modest: You are starting out very well! Your code and explanations are very understandable. I love the fact that you are writing a 0x88 engine from scratch, that's different from Bluefever's mailbox engine. I like the fact that you're doing your own thing from scratch, and not just forking VICE and going from there. (Nothing wrong with that, but I just like engines from scratch better when following development.)

I'm definitely going to watch your entire series, because I don't know too much about 0x88 engines. (I immediately jumped into magic bitboards... which took me quite some time to figure out due to not wanting to look at other people's code.)
Thanks for your feedback and I appreciate your attention.
Gladly. Your coding style is very understandable. I saw you mentioning that you "ended up with structs containing data, and then passing those structs to functions." It sounds as if you are not satisfied with that.

Well, in C it's actually a very common way of doing things. You often see a pseudo object oriented style like this, called an abstract data type (ADT):

Code: Select all

struct SomeData {
...
}

somedata_add_more_things(SomeData *sd, <and some more stuff here>) { ... }
somedata_remove_stuff(SomeData *sd, <and some more stuff here>) { ... }
In Rust, this is actually the normal style. The only change is that the functions are part of the struct, and so the first argument is replaced by "self":

Code: Select all

struct SomeData {
	...
}

impl SomeData {
	pub fn add_more_things(&mut self, <some more stuff here>) { ... }
	pub fn remove_stuff(&mut self, <some more stuff here>) { ... }
}
The syntax is somewhat different, but the concept is exactly the same. So in my eyes, you can be satisfied with "ending up" with structs that are passed to functions by pointers... it's a very common design pattern in low(er) level languages.

The one thing that I'd actually critique is... ]less global variables. That is not good practice, and it will probably get you into problems when trying to add multi-threading to the engine somewhere in the future.

You're doing a great job. I look forward to watching these video's.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

!

Post by Richard Allbert »

maksimKorzh wrote: Sun Aug 23, 2020 2:18 pm Hmmm... this quote makes me assume... Richard, ARE YOU BLUEFEVER SOFTWARE???
Yep, that's my small contribution to the great community.

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

Re: Chess programming on YouTube: NOBODY CARES?

Post by maksimKorzh »

mvanthoor wrote: Sun Aug 23, 2020 5:47 pm
maksimKorzh wrote: Sat Aug 22, 2020 11:53 pm This is great. I'm tempted to follow your series. Hope you'll post it on this forum one day.
Thanks :) I will. At the moment development speed is about as fast as molasses flowing uphill due to:

- Vision problems (hopefully to be resolved next week)
- Me writing in Rust instead of C; I'm still jacking around with the program to get it written in proper "Rust-style" and not in "C-style." (I don't want to write a program that is basically a C program written in Rust syntax.) So I'm often rewriting / changing things.
- Because Rust is so new, I'm sometimes hitting snags, such as a massive slowdown in the latest version of the compiler. I then have to look into that, and either resolve it in my code, or file a bug report.
I'm not a native speaker as well))) And doing videos live without editing, only pausing when stuck and the resume recording.
I've watched some of your first video's on the 0x88 engine.

Your English is very good. It's near-fluent, and easily understood. I love how you say "rewersal" :) It makes me think of Star Trek IV, where Pavel Chekov asks an American navy officer: "Do you know where the nuclear wessels are?" (Where he heavily exaggerates, on purpose, the tendency of Russian speakers to pronounce a V as a W.)

You don't have to be modest: You are starting out very well! Your code and explanations are very understandable. I love the fact that you are writing a 0x88 engine from scratch, that's different from Bluefever's mailbox engine. I like the fact that you're doing your own thing from scratch, and not just forking VICE and going from there. (Nothing wrong with that, but I just like engines from scratch better when following development.)

I'm definitely going to watch your entire series, because I don't know too much about 0x88 engines. (I immediately jumped into magic bitboards... which took me quite some time to figure out due to not wanting to look at other people's code.)
Thanks for your feedback and I appreciate your attention.
Gladly. Your coding style is very understandable. I saw you mentioning that you "ended up with structs containing data, and then passing those structs to functions." It sounds as if you are not satisfied with that.

Well, in C it's actually a very common way of doing things. You often see a pseudo object oriented style like this, called an abstract data type (ADT):

Code: Select all

struct SomeData {
...
}

somedata_add_more_things(SomeData *sd, <and some more stuff here>) { ... }
somedata_remove_stuff(SomeData *sd, <and some more stuff here>) { ... }
In Rust, this is actually the normal style. The only change is that the functions are part of the struct, and so the first argument is replaced by "self":

Code: Select all

struct SomeData {
	...
}

impl SomeData {
	pub fn add_more_things(&mut self, <some more stuff here>) { ... }
	pub fn remove_stuff(&mut self, <some more stuff here>) { ... }
}
The syntax is somewhat different, but the concept is exactly the same. So in my eyes, you can be satisfied with "ending up" with structs that are passed to functions by pointers... it's a very common design pattern in low(er) level languages.

The one thing that I'd actually critique is... ]less global variables. That is not good practice, and it will probably get you into problems when trying to add multi-threading to the engine somewhere in the future.

You're doing a great job. I look forward to watching these video's.
Gladly. Your coding style is very understandable. I saw you mentioning that you "ended up with structs containing data, and then passing those structs to functions." It sounds as if you are not satisfied with that.
Ha-ha)) this simply means that when I didn't know C at all and was following Blufever's series I was distracted all the time by attempts to realize the logic of interaction between newly created structs and pointers to them, e.g. you create a board struct and then passing it to every single function working with board - that was annoying because I wanted to focus on chess programming concepts instead learning C best practices. Obviously later I've mastered structs and how to manipulate pointers to them) btw mostly thanksfully exactly to Bluefever. So I was unsatisfied with the way I was forced to learn, not with techniques themselves when I learned how to apply them. I had a period enjoying crafting class-like structures with pointers to functions as methods - that helped me a lot to understand how OOP works at low level.

The only change is that the functions are part of the struct, and so the first argument is replaced by "self":
Cool, almost like in python))
The one thing that I'd actually critique is... ]less global variables. That is not good practice, and it will probably get you into problems when trying to add multi-threading to the engine somewhere in the future.
I'm just trying to give my viewers an opportunity to focus on CHESS PROGRAMMING instead of C BEST PRACTICES. As soon as they learn core concepts it would already be on their owns how to apply best practices while creating their own engines. Obviously it's not a problem to encapsulate board related variables into a struct one day and just provide macros replacing "side" with "board->side" and then just add struct pointers to the functions, even though it's a bit of pain but doable. And also we're not writing Stockfish powered by NNUE, but a simple alpha-beta engine. Btw one of solutions I'm really proud of - scoring moves on the fly instead of doing this during move generation. Even though it might seem a bit weird, still pretty nice from the performance perspective - yes, it's slightly slower BUT it gives a MODULAR solution where you can work on SEARCH separately WITHOUT ever touching move generator. I believe it's a big advantage from the didactic perspective.
You're doing a great job. I look forward to watching these video's.
Thanks for your feedback!

btw, you've INTRIGUED me with RUST. Could you please give a brief overview of C vs RUST comparison according to your vision and WHY exactly you prefer rust oves C to create your engine apart from being unique and not following someone else's code? I would really appreciate if you share your opinion at this point.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: !

Post by maksimKorzh »

Richard Allbert wrote: Mon Aug 24, 2020 7:01 pm
maksimKorzh wrote: Sun Aug 23, 2020 2:18 pm Hmmm... this quote makes me assume... Richard, ARE YOU BLUEFEVER SOFTWARE???
Yep, that's my small contribution to the great community.

Good luck with yours!!
OMG! Now I finally know your name! I've been sending you some comments regarding minimalist chess engine in python involving 0x88 and you kindly replied to me! That was such an honor!

I didn't ever mean to insult you by saying you've disappeared I just meant no more chess engine videos. I'm still your subscriber on YouTube and know that you're making some videos from time to time. Your python3 series is great, I can say that as professional python developer.

And as far as the fate let me chat with you here, I won't lose a chance to THANK you again via mentioning HOW EXACTLY your series has CHANGED MY LIFE believe it or not, so you have:

1. MOTIVATED me to learn Javascript (first I saw your chess engine in javascript series)
2. MADE me learn C programming language (I didn't want to first, but had to in order to complete your chess engine in C series)
3. HELPED me to finally realize WHAT we need to do within a MAKE MOVE function which let me pass the perft test for the first time in my life! (after 1.5 - 2 years of unsuccessful attempts)
4. INSPIRED me to start YouTube channel that eventually helped me to become a freelance developer (my previous job wan't related to programming at all)
5. CREATED lots of request for bitboard chess engine series by creating your legendary chess engine in C series so that now I'm making great use of it by actually creating bitboard chess engine tutorial series trying to follow your OLD SCHOOL style (

So I just can't find enough words to thank you.

Richard, as your big fan I just can't stop myself from asking you some questions:
1. Did you write any engine after VICE?
2. Are you doing some chess programming now?

And one last, I know it's not my business, but you've been mentioning that you're a self-taught programmer, but regardless of that for some reason I had a strong belief that your working as a developer professionally. Is that so? I'm asking not just due to curiosity but because back in those days for some reason I though that you're a self-taught programmer who landed a job as programmer, obviously I don't know that but I was so sure that it's true so that one day I wanted to change my life completely and become a self-taught programmer who lands a job))) Now it sounds funny to me but if you could ever imagine how this belief (even if it's not true) helped me eventually to change my life. But obviously I understand if you don't answer for it's personal.

Any way, thank you so much again, it's a great honor for me to have this chance to chat with you here.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: !

Post by mvanthoor »

Richard Allbert wrote: Mon Aug 24, 2020 7:01 pm Yep, that's my small contribution to the great community.

Good luck with yours!!
"A small contribution" he calls that. That chess engine series is legendary, as Maksim says. IMHO, it's one of the best resources on the internet. (I've actually downloaded all the video's from Youtube and archived them...). Even though I didn't always implement the concepts the same way as you did, the series was extremely useful as a thorough refresher on the topics needed to successfully writing a chess engine. I studied some of them somewhat haphazardly as a teenager, and others when I was in university, but then didn't do anything with them for almost 20 years. So your video's as a crash course were VERY welcome.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Chess programming on YouTube: NOBODY CARES?

Post by mvanthoor »

maksimKorzh wrote: Mon Aug 24, 2020 8:03 pm Thanks for your feedback!

btw, you've INTRIGUED me with RUST. Could you please give a brief overview of C vs RUST comparison according to your vision and WHY exactly you prefer rust oves C to create your engine apart from being unique and not following someone else's code? I would really appreciate if you share your opinion at this point.
There are several reasons.

- Rust is (almost) as safe as garbage collected languages, but with the speed of C. It achieves this by rigidly adhering to the principle that you can have only a single owner of some memory space. (This means that you can have many readers, or a single writer.)
- This makes sure that Rust is safe from memory leaks, race conditions, thread deadlocks, etc....
- (PS: This doesn't mean your program can never panic or crash. That's something different.)
- The language has a great static analyzer / code sanitizer built in. If you do something, anything, that is unsafe (like moving a struct in memory and then using it in the old location afterward), the compiler will not compile your code. (If you use rust-analyzer in your IDE, such as MS VSCode, the IDE will even tell you, even before you compile.)
- Rust has a package manager, called cargo. (Compare to Python's "pip", or Javascript "NPM"; or even Debian's "apt") No hassles installing dependencies.
- Rust has a toolchain manager, called "rustup", that can update, install, uninstall, and switch toolchains.
- It has a -single- build system through the package manager: "cargo build". No need to take several build systems into account.
- It has (at this point) a single compiler. No need to take 5 different compilers into account.
- This means that "cargo build" should run and create an executable on any supported operating system, with any supported toolchain.
- If you know C well, and can do memory management reliably there, your code is probably safe, and then Rust is quite easy to pick up. If you don't understand C and memory management that well and write unsafe/crashy programs in C, Rust is the horror of horrors, because you will against the compiler indefinitely.

For me, Rust feels like... C... but designed in 2015 instead of 1973.

(On the other hand, Go feels like... C... designed in 1995, in an effort to make C compatible with the internet... but that's another story.)

Still, after I finish my engine, I'll probably port it to C someday, just because I can. I like C. I just like Rust better nowadays :)

The engine is here, by the way, if you want to take a look at the code or download and compile it: https://github.com/mvanthoor/rustic

It is now at the stage where it successfully runs perft. Next will be the search, evaluation, and uci functionalities. Some of those have partly been written, but not yet merged due to development temporarily being on hold.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
No4b
Posts: 105
Joined: Thu Jun 18, 2020 3:21 pm
Location: Moscow
Full name: Alexander Litov

Re: Chess programming on YouTube: NOBODY CARES?

Post by No4b »

I took a brief look into the videos, although did not had time right now watch even one of the entirely.
I can give more of a feedback later.

Overall i think its great that more chessprogramming series are appearing - the more the better, just because one can get more inspiration (and understandings) from watching similar stuff being implemented differently.

As for what I wanted to see:
I would love to see more implementations of a more advanced stuff than in the bluefever videos both in eval (like, maybe, king danger) and in search (LMR).