Hacker News new | past | comments | ask | show | jobs | submit login
Engineering a Chess Match (mbrt.dev)
103 points by underdeserver 14 days ago | hide | past | favorite | 22 comments

I love how this is written from the perspective of an engineer exploring chess. This studying method is used by top chess players as well, where computers prepare variations for their opponent's most commonly played openings. Bobby Fischer had only one assistant to help calculate variations against Boris Spassky's team of Russian grandmasters in their famous match - nowadays, both amateur and professional players alike use computers to prepare against opponents.

The result of the final match from the post is actually a great example of why centipawn advantages don't matter as much in human play - humans don't always make the best moves, and there is a psychological element to chess which is hard to capture with a computer. The example that comes to mind is a famous match between Rashid Nezhmetdinov and Oleg Chernikov where Rashid sacrifices his queen for a brilliant attack: https://www.chessgames.com/perl/chessgame?gid=1260278

I've just started playing again after dabbling as a youth (pre internet) and one thing I've noticed is that psychology against an inexperienced human is very different compared to playing an experienced human or a computer.

In a recent game I took a fair amount of time, and then when I noticed my time running out I made a move in a panic and left a rook hanging. A total blunder. All my opponent had to do was take it and I was ready to resign.

But because I'd taken a considerable length of time I assume my opponent thought it was a very deliberate move. A poisoned piece. He/she didn't take it and I went on to win the game.

I wrote a similar tool, but for winning openings in general, rather than for a specific player [1].

It assumes the opponent will always play according to the probability statistics of Lichess users at a certain level, and gives you the moves that will lead to the highest expected evaluation.

There are some pretty fun lines, like: 1. g3 d5 2. Bh3 Bxh3 3. Nf3... I guess white players in the Hungarian just blitz out the first moves, not assuming anyone will capture...

[1]: https://github.com/thomasahle/chess-openings-expectimax

A friend of mine is good friends with an IM. The IM showed him a position he had found which computers analyze incorrectly, which he was waiting to use in a match. It arises form the Open Sicilian, but fairly deep in. It's been about 10 years since he showed it to me, and AFAIK he still hasn't been able to use it. I've since forgotten the position, but I did find that it had occurred many times in GM play, just not for him. Part of that is likely that he's well known for being good at the Open Sicilian, so people he plays are likely to avoid it.

I asked him how long it took him to find such a position, which was met with laughter and a statement to the affect of "Way more than I want to admit". Which led us into a discussion of the obvious, that it's great to find such situations, but you can't rely on them. Even if he ever gets to use it, he only gets to use it once, after that, everyone will know about it. So, not only does he have to wait for the position to occur, but he'll only use it in a game that really matters.

There are many books on "opening traps", and every one that I've read always has the disclaimer that it's not at all good to rely on these, it's only a good idea to be familiar with them so you don't fall for them. And, on the off chance that you do gain an advantage, you still have to convert that into a win. We didn't actually play a game from the position mentioned above, but we did discuss it, and it's pretty clear I'd still get my *ss handed to me against an IM.

If anyone else needs help beating their online-chess-playing brother, https://www.openingtree.com/ can be used to find their most common moves, as well as the results of the games where those moves are played.

What does this provide that the chess.com analysis engine doesn't? I'm a chess rookie but I find the engine's suggestions and playing through paths much more useful than just seeing what moves people have played against me and their win rates. Is this a tool that only becomes useful for higher rated players?

It’s useful to study the positions you might see in a game and prep your opening lines and plans before you play. Obviously if you playing a random opponent it’s not that useful, but there are leagues such as the 45+45 league where you know your opponent up to a week in advance.

Ah I hadn't clocked that part - it's actually a tool to get the upper-hand against a _particular_ known opponent. Not that useful to me, but cool to know it exists!

Also try lichess, it's free and open source.

It's interesting that the "probability to distance" function (-log(prob(edge))) wound up being the information-theoretic entropy [1]. I wonder if there's anything deeper there?

[1]: https://en.wikipedia.org/wiki/Entropy_(information_theory)

Yes. Probability of reaching a game position is a product of the per-move probabilities, so adding them up tells you how much "luck budget" you need to reach that position, or equivalently, how much information is required to pick that position out of the distribution over positions reached (by a particular player, in this case).

I can't find a video on it now but chess world champ Vishy Anand has a big computer analysis system (super computer?) and team that analyses opponent matches and then he does intense preparation with this data. The documentary Magnus has a great segment on Anand and his appeoach before he and Magnus Carlsen play in finals.

As an amateur chess player and a software developer that has made some chess side projects in the past, I thoroughly enjoyed this post. Thank you for writing this up.

I too have a friend that has way more chess ability than me, I’m trying to beat him the old fashioned way but I’ll also take a crack at it using this approach, for fun.

This is brilliant. I've found myself in a similar situation with my cousin as we've both taken up Go in the pandemic, and it's fun reading someone else describe some of the same things I've noticed. What has stuck with me a lot a year into this is how much psychology has played a role in our play, in the sense that while our play certainly is very sub-optimal when compared to any decent Go engine, it's always sub-optimal in a given direction that you could describe in psychological terms ("we play scared, or overly arrogant, etc."), and it's been fun seeing our tactics change to take advantage of some of those very human tendencies.

I'm shoked by Lichess ratings. The graph indicates that 1380 Elo ranks you above 36% of Rapid players. On chess.com, 1200 Elo ranks you above 80% of Rapid players.

They’re different ratings systems, and not meant to be directly comparable.

Chess.com uses Glicko with an initial rating of 1200 (https://support.chess.com/article/210-how-do-ratings-work-on...), while Lichess uses Glicko-2, and sets their initial rating to 1500 (https://lichess.org/page/rating-systems).

Just anecdotally, I’m an ~1800 rated player on chess.com, and ~2050 on Lichess. Percentile rank wise, I’m in the top 3.5% on chess.com, and closer to top 10% on Lichess.

I think this matches the general perception that Chess.com has many more casual players. This is likely a function of all the cross promotion they’ve done to grow the game, especially on Twitch. Neither site is “good” or “bad”, but my friends who play casually seem more likely to play on Chess.com.

> I’m in the top 3.5% on chess.com, and closer to top 10% on Lichess

You are correct that ratings are not comparable, but percentiles are not really comparable either. IIRC, chess.com computes the percentile rank on the overall player population, while lichess only compares the score of players who have been active in the last 7 days.

> Just anecdotally, I’m an ~1800 rated player on chess.com, and ~2050 on Lichess

I have similar ratings to yours on both sites, can confirm the anecdata.

> I think this matches the general perception that Chess.com has many more casual players.

I guess it depends on what you define as "casual". Chess is a game where ratings work beautifully because it's individual and there's not a lot of randomness, so your rating will converge on your skill in short order.

What I noticed is that there are a lot of casual players on both sites, but Chess.com has a "wider" distribution if that makes sense, with lots of absolute beginners (think <1100 chess.com), while lichess seems to have less of those.

Also, IIRC lichess has an absolute rating floor at 800, while chess.com doesn't have one.

Thanks for the explanation. Do you know which one would be closer to FIDE or club ratings?

Thanks. TL;DR: chess.com is closer to FIDE than Lichess.

Absolute Elo ratings have no meaning. The system is set up so that differences between Elo ratings are predictive of the outcome of a game. There's nothing anchoring the overall scale, though, and you can add in an arbitrary constant to every player's Elo without changing any of the predictions about who will win a given game.

This is an awesome post. Really well written.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact