Tiny Chess Bot Coding Challenge

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Tiny Chess Bot Coding Challenge

Post by leanchess »

P.S. TalkChess Bot 0.5 is still alive (but isn't that well ;))
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Tiny Chess Bot Coding Challenge

Post by lithander »

Mike Sherwin wrote: Mon Sep 04, 2023 11:07 pm v4 is now playing and does not appear to be buggy. V4 has played 8 games and is at 1065 and climbing.
There's also v5 with 719/1024 tokens and support for hash-moves!
https://chess.stjo.dev/bot/1821/

Considering that all bots start at 1000 the current Elo rating of 1105 after 12 games is nowhere near it's peak! I'd pay €€ right now for a few hundred games just to know where we stand! Isn't that a great business opportunity for the page owner? :lol:
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
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 »

lithander wrote: Tue Sep 05, 2023 11:21 am
Mike Sherwin wrote: Mon Sep 04, 2023 11:07 pm v4 is now playing and does not appear to be buggy. V4 has played 8 games and is at 1065 and climbing.
There's also v5 with 719/1024 tokens and support for hash-moves!
https://chess.stjo.dev/bot/1821/

Considering that all bots start at 1000 the current Elo rating of 1105 after 12 games is nowhere near it's peak! I'd pay €€ right now for a few hundred games just to know where we stand! Isn't that a great business opportunity for the page owner? :lol:
I was wondering how many games $5 would get me? A distributed (is that the right word) bot hosting network (can't host your own bot) would do the trick though.
User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Tiny Chess Bot Coding Challenge

Post by leanchess »

The leaderboard is broken, but pretends not to be. I'm guessing the site owner is busy at school.
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Tiny Chess Bot Coding Challenge

Post by dangi12012 »

This competition is actually much cooler than I thought. The usual mess of "as little characters as possible" are totally replaced by pure simplicity and a nice concice and for the most part readable coding style since we count C# tokens.

IMO this should be repeated in the future but everyone gets the same NNUE silent eval to work with. 4096 tokens but you can focus purely on the treesearch and seval() is provided.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
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 »

dangi12012 wrote: Thu Sep 07, 2023 4:39 pm This competition is actually much cooler than I thought. The usual mess of "as little characters as possible" are totally replaced by pure simplicity and a nice concice and for the most part readable coding style since we count C# tokens.

IMO this should be repeated in the future but everyone gets the same NNUE silent eval to work with. 4096 tokens but you can focus purely on the treesearch and seval() is provided.
Actually 1024 tokens is more than it seems if token use is optimised well.
Thomas has the most up to date sources so he could better give this information. But here is my educated guess on token usage. I'd say that we are around 800 tokens used and we hane:
.alpha/beta negamax with zero window searches
.advanced sorting at the root
.killer moves
.a full TT with best move (but we ignore mate scores)
.time management
.an advanced PeSTO evaluation

And with roughly 200 tokens to spare there is room for futility cuts, aspiration windows, and IID plus more. With 1024 tokens I believe it is possible to write a 2700+ elo engine!. And Daniel, if you want to contribute there is still room on the team. :D
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Tiny Chess Bot Coding Challenge

Post by lithander »

dangi12012 wrote: Thu Sep 07, 2023 4:39 pm This competition is actually much cooler than I thought. The usual mess of "as little characters as possible" are totally replaced by pure simplicity and a nice concice and for the most part readable coding style since we count C# tokens.
I agree token count is a really interesting metric but don't kid yourself: You're just compelled to make other foul compromises instead. ;)
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Tiny Chess Bot Coding Challenge

Post by leanchess »

You can still do pretty neat stuff within those limits.

For example, I wanted to fit a Move within 16 bits (for some reason in ChessChallenge.API it takes 32), so I came up with this:

Code: Select all

            Move bestMove = depth > 1 && (m = _table[i] << 3 | 0x20000) != 0x20000
                ? new(new("a1a1 ".Select(c => (m >>= 3) > 8 ? (char)(c + m % 8) : "qnrb"[m & 3]).ToArray()), board)
                : default;

That fully recreates the move's UCI string, including underpromotions (it will put a Q at the 4th index when there's no promotion, but the infrastructure doesn't care about that).

Then I remembered I could just find a move in the movelist by RawValue.

Putting it here for posterity so all that hard work isn't completely lost.


P.S. My latest source (with all the aforementioned features) is 696 tokens.
User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Tiny Chess Bot Coding Challenge

Post by leanchess »

The newest version is exactly 100 tokens larger, but it has full TT, and there are still some token optimisations to be made (~30 tokens)!
User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Tiny Chess Bot Coding Challenge

Post by leanchess »

leanchess wrote: Mon Sep 11, 2023 5:54 pm The newest version is exactly 100 tokens larger, but it has full TT, and there are still some token optimisations to be made (~30 tokens)!
Did I say ~30 tokens? It's exactly 766 now! :P