Tiny Chess Bot Coding Challenge

Discussion of chess software programming and technical issues.

Moderator: Ras

Mike Sherwin
Posts: 965
Joined: Fri Aug 21, 2020 1:25 am
Location: Planet Earth, Sol system
Full name: Michael J Sherwin

Re: Tiny Chess Bot Coding Challenge

Post by Mike Sherwin »

Ras wrote: Tue Aug 08, 2023 9:00 pm
Mike Sherwin wrote: Tue Aug 08, 2023 8:02 pmCount all the moves of regular search for each root move (edit: for both sides).
That only tells about the properties of the root position, but does not contribute to the engine picking up the best move, and that's what an engine is for.
Martin Sedlak used this basic idea for move ordering at the root and reported +20 elo. I used only checkmates on a material only searcher and while it did not play great it did seek to checkmate the opponent. And I'm not saying that it is to be used standalone. I'm saying normalize the contribution from this idea to a gentle influence only. It is valuable information to have. Why not use it?
User avatar
Ras
Posts: 2695
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Tiny Chess Bot Coding Challenge

Post by Ras »

Mike Sherwin wrote: Wed Aug 09, 2023 5:06 amMartin Sedlak used this basic idea for move ordering at the root
That's not what you suggested in your previous posting.
and reported +20 elo.
I don't think that this will score any better than the standard "one move plus QS" for the initial root move ordering. The main purpose of that is IMO to move likely bad moves towards the end of the list so that LMR will work better.
I used only checkmates on a material only searcher and while it did not play great it did seek to checkmate the opponent.
Unless the main search is buggy, mate-in-1 should be obvious in the main search anyway.

Or is the point that due to token limitation, there is no usual main search intended?
Rasmus Althoff
https://www.ct800.net
Mike Sherwin
Posts: 965
Joined: Fri Aug 21, 2020 1:25 am
Location: Planet Earth, Sol system
Full name: Michael J Sherwin

Re: Tiny Chess Bot Coding Challenge

Post by Mike Sherwin »

Ras wrote: Wed Aug 09, 2023 7:17 am
Mike Sherwin wrote: Wed Aug 09, 2023 5:06 amMartin Sedlak used this basic idea for move ordering at the root
That's not what you suggested in your previous posting.
and reported +20 elo.
I don't think that this will score any better than the standard "one move plus QS" for the initial root move ordering. The main purpose of that is IMO to move likely bad moves towards the end of the list so that LMR will work better.
I used only checkmates on a material only searcher and while it did not play great it did seek to checkmate the opponent.
Unless the main search is buggy, mate-in-1 should be obvious in the main search anyway.

Or is the point that due to token limitation, there is no usual main search intended?
Let's imagine that two root moves are very close in their normal eval. But one of the moves score far more checkmates than the other--that is an indication that there are more ways for the other side to go wrong. It would be similar for null move threats. The engine has to choose between two moves. The one move scores 4 centipawns more but has a much larger number of null move failures indicating that it has to navigate a minefield of threats. Or maybe a move causes the opponent a larger number of null move failures and thus gives the opponent more chances to go wrong. In search it is not only about where it ends up but also the path that is taken to get there when null move and LMR fails. What I described is just the beginning of statistical analysis of root moves. Just a first experiment that I believe is worth investigating.
User avatar
Ras
Posts: 2695
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Tiny Chess Bot Coding Challenge

Post by Ras »

Mike Sherwin wrote: Wed Aug 09, 2023 10:17 amLet's imagine that two root moves are very close in their normal eval. But one of the moves score far more checkmates than the other--that is an indication that there are more ways for the other side to go wrong.
A one-move deep "threat" is a non-issue for an engine opponent. All it indicates is that the first move necessitates a forced answer, not that it is good in any way. That kind of logic would usually appear in the search itself as "singular extension".
Rasmus Althoff
https://www.ct800.net
Mike Sherwin
Posts: 965
Joined: Fri Aug 21, 2020 1:25 am
Location: Planet Earth, Sol system
Full name: Michael J Sherwin

Re: Tiny Chess Bot Coding Challenge

Post by Mike Sherwin »

Ras wrote: Wed Aug 09, 2023 10:47 am
Mike Sherwin wrote: Wed Aug 09, 2023 10:17 amLet's imagine that two root moves are very close in their normal eval. But one of the moves score far more checkmates than the other--that is an indication that there are more ways for the other side to go wrong.
A one-move deep "threat" is a non-issue for an engine opponent. All it indicates is that the first move necessitates a forced answer, not that it is good in any way. That kind of logic would usually appear in the search itself as "singular extension".
You are not understanding what I am trying to say. And I don't know how to describe it any clearer. But I'll try. It says nothing about whether a root move is a threat or not a threat. All it does is count checkmates and null move failures in the entire subtree for both sides for each root move. It is just an indication of danger for one side or the other inherent in making that move.

In a simple bot that is a material only searcher it can choose between two equal root moves and play quite intelligently. I'm just proposing an experiment. What's wrong with that?
User avatar
hgm
Posts: 28350
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Tiny Chess Bot Coding Challenge

Post by hgm »

Mike Sherwin wrote: Tue Aug 08, 2023 8:02 pm
hgm wrote: Mon Aug 07, 2023 11:24 pm MicroMax has no PST.
Will you be submitting an entry?
In C#? I don't think so.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Tiny Chess Bot Coding Challenge

Post by mvanthoor »

eduherminio wrote: Mon Aug 07, 2023 3:35 am Your Rustic blog has been linked quite a few times in the community Discord of the challenge :D
Cool, but why? There's not too much information in there yet. It's not even complete and the engine's development is down to a snail's pace because of life getting in the way (like, moving, decorating/changing the new house, etc). Maybe, before starting to code on the engine again, I should try to write some stuff for the Rustic website, because I can do that piece-meal, like page-by-page.

Also, I don't really see how a chess engine written from scratch in Rust could contribute to writing this challenge's engine in C# with a limited amount of tokens...
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
eduherminio
Posts: 76
Joined: Mon Apr 05, 2021 12:00 am
Full name: Eduardo Caceres

Re: Tiny Chess Bot Coding Challenge

Post by eduherminio »

mvanthoor wrote: Tue Aug 15, 2023 3:21 pm
eduherminio wrote: Mon Aug 07, 2023 3:35 am Your Rustic blog has been linked quite a few times in the community Discord of the challenge :D
Cool, but why? There's not too much information in there yet. It's not even complete and the engine's development is down to a snail's pace because of life getting in the way
Because CPW is apparently an elephants' graveyard and your blog is more.. contemporaneous?
SPRT and Move Ordering sections were the linked ones, which I also found very useful myself!
Author of Lynx chess engine (GitHub, Lichess)
User avatar
flok
Posts: 558
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Tiny Chess Bot Coding Challenge

Post by flok »

hgm wrote: Fri Aug 11, 2023 8:32 am
Mike Sherwin wrote: Tue Aug 08, 2023 8:02 pm
hgm wrote: Mon Aug 07, 2023 11:24 pm MicroMax has no PST.
Will you be submitting an entry?
In C#? I don't think so.
C# is available for Linux!
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Tiny Chess Bot Coding Challenge

Post by mvanthoor »

eduherminio wrote: Tue Aug 15, 2023 7:05 pm Because CPW is apparently an elephants' graveyard and your blog is more.. contemporaneous?
SPRT and Move Ordering sections were the linked ones, which I also found very useful myself!
Thanks :)

CPW is indeed old in many regards, but it is still a good starting point.

Before spending time on (finally) finishing the next Rustic version, it seems it is more important to get the big parts of the chess engine documented, especially magic bitboards. That was a BEAR to get my head around, because many articles explain what they should do, but on the technical details they often deteriorate into incoherent and inconsistent gibberish. Fortunately I documented the workings extensively in the source code itself, so it should be fairly doable to write some pages about this. (There is only one little part I don't understand, but that's a mathematical way to very quickly generate bitboards without a loop. I reference a CPW article about this function. I could have done it with a loop obviously, but then the startup of the engine would have been much slower.)

SPRT is also something that is explained inconceivably bad throughout the internet. The stuff on my website was determined by experimentation: basically try something and see if the result is as expected until I found out how it actually works.

I intend, at some point, to have a website that I can make into a PDF and/or a book even, which can be referenced to write a chess engine in ANY programming language.

I'm quite sure that, if I would start a new engine in a different programming language, I'm going to need it myself; or the code and comments of Rustic itself. I probably couldn't do it on top of my head anymore at this point.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL