r/ComputerChess • • 2d ago

Chess engine to find checkmate vs humans as fast as possible - does anything else like this exist?

Inspired by YouTube challenges where GMs must mate amateurs within 20–25 moves, I wondered: how fast could a chess engine checkmate a human if that were its only objective? (and knowing it must resign on, say, move 26 no matter what)

What I built: an engine explicitly optimized for speed of mate against humans. Details:

  • Openings: started by mining ~100GB of Lichess games for Elo-specific opening books (shortest average games, not best evals). Now the books are built offline by simulating games against Maia-3 at each rating, with a separate book for each move limit. For the shortest limits it uses a value net trained by self-play against Maia-3.
  • Midgame: uses Maia-3 to predict likely human responses. Stockfish suggests candidate moves, each one gets played out in a bunch of simulated games vs Maia, and it plays whichever mates most often before the deadline. As a result, it plays moves that an engine like stockfish would destroy, but that a human will probably fail against.
  • Endgame: 2-3 moves from the deadline it switches to an exact calculation of the mate chance over the human's likely replies (not forced mates, but most likely mates against a human).

Why standard engines struggle: even aggressive engines optimize for objective soundness and win probability instead of risky lines that might mate much faster. I've had this program running for over a year, and it exists as a lichess bot, and A/B testing shows it is better than Leela with high Cpuct, Komodo with high contempt, stockfish 11 with high contempt, and stockfish 19. I'm an average player and can avoid checkmate until move 41 vs stockfish19, around move 35 against the other "aggressive" engines, but can never last until move 25 against this engine.

I'd love links to any work/projects on minimizing time-to-mate against human play (I couldn't find any). I have no intent to ever make money from this. Just a fun project.

Apologies this is sort of a repost from a year ago (and I've posted about this a few times in between), but LLMs have contributed to a lot of new chess projects and I'm wondering if anyone else has tried this. It seems like an intrinsically interesting problem to me, and I would guess someone smarter than me has done something better, maybe using a custom Leela training build.

If anyone wants to try it, you can play here & view code: http://siegechess.com
It's also playable on LiChess as
https://lichess.org/@/mate-in-twenty (best if your ELO is ~1400 or lower)
https://lichess.org/@/mate-in-thirty (1400–2200)
https://lichess.org/@/mate-in-forty (2200+)

4 Upvotes

6 comments sorted by

2

u/jan_de_boer 2d ago

Very interesting!
I’m around 1600-1700 in Blitz on Lichess and played the mate in twenty bot.
It gave up a knight quite early so I felt quite safe (sf gave me up to +6.5) but the situation was pretty tricky and with a sequence of 2-3 bad moves I almost blew the game. I think I would have lost before move 25.

And it was the early knight sacrifice that opened the g file which caused my troubles. I’m very impressed sacrifice in particular.

Also for reference I played sf before and survived for 37 moves.

So all in all very nice, reminds me of some other approaches I saw here, training engines to specifically target its opponents deficiencies.
Do you have any plans or ideas to continue in that direction?

2

u/dig9977 2d ago

Thanks for playing!! When it has to get checkmate in 20 moves or less it often sacs an early piece to make the position more open. Doesn’t happen when it has 30 or 40 moves.

No plans to target individual people’s deficiencies. It currently works by running simulations on what moves human players are likely to make, so it’s theoretically already based targeting opponent deficiencies.

1

u/Hakorr 1d ago

can avoid checkmate until move 41 vs stockfish19

At what depth?

1

u/dig9977 1d ago

Just playing without a clock, probably averaging 5 or 10 seconds per move, with unlimited depth. Depth maybe getting to around 30 in the early game and 40 in the mid/late game?

2

u/Hakorr 1d ago

Oh wow, cool project. I was initially going to make a snarky comment about how Stockfish already tries to find checkmate as quickly as possible because "why wouldn't it if it meant winning faster", but you gave me new perspective on how things actually work.

1

u/dig9977 1d ago

Check out this game that just happened. Siegechess was pretty much lost (only being up a pawn vs a high rated player and only 10 moves left to find checkmate). It started doing kind of weird knight and king shuffling to maximize the chance the opponent would blunder into a checkmate it was seeing via Maia-3 simulations… It worked and I hope this guy didn’t throw his computer out the window… https://siegechess.com/replay.html?game=L1T5cxjwo