Finding surprising moves in chess games
github.com
github.com
This is pretty interesting, but I'm not sure if it fully captures all the nuances of what a surprising move is. You might be able to classify a move as tactically surprising if it becomes clear after depth 7 that the ending position is favorable. However, in my opinion truly surprising moves are ones that carry plans that I haven't even considered. Hence, this methodology doesn't capture moves that are positionally surprising as there wouldn't be such a drastic change in evaluation at different depths. I'm not sure where you would start to figure that one out though :)
That being said this is really cool work!
Take a database of games from pro players; Take the set of all moves where Stockfish-5 agrees that the move actually played is the optimum. Filter for all the moves where Stockfish-11 has a different opinion that results in a big gain in position. What you get is a list of moves that would surprise pro-players under time pressure.
I wouldn't be surprised if professional chess players are all running a version of this against individual known opponents before a tournament to probe for weaknesses.
A harder problem would be to cross-reference this final list with the post-game opinions published by professional commentators and identify major discrepancies. This would be the "wouldn't have thought of it in a million years" list.
As to your second point, an issue with how computer chess affects the modern scene is how playing the "best" move in any given position isn't representative of how humans play. Humans carry out plans and evaluate positions to the best of their ability, but the heuristics and procedure they use aren't the same as a computer's. For example, Karjakin didn't prepare for his match against Carlsen last month by playing a bunch of games against Stockfish. Rather he probably analyzed Carlsen's past games and opening choices to come up with a strategy.
I do think you can come up with a way to prepare against individually known opponents by identifying weaknesses programmatically. You can model a human's approach to playing chess as a distribution of parameters (material, king safety, pawn structure, etc.) that take in the current position and return the best move. You also have Stockfish's evaluation which returns the "best" move. With this, it's possible that you could use build a neural network that learns to play very similarly to a certain player by using their past games as a training set and comparing the chosen move to Stockfish's move. The network could learn to mimic the heuristics that the human individual uses to make decisions and playing against this new AI would be great practice for preparing against specific opponents.
My question is, is there any difference here that can't be solved by, say, upping the ply-number?
On humanlike chess-AI: have an adversarial network that works to classify human vs machine players, and optimize for humanness * strength-of-play in the AI?
These advantages aren't the kind where you can sit back and let the game play out confident of winning. It's a deliberate unbalancing of the equilibrium of the position, and one where this temporary dynamic advantage needs to be used to create a longer-lasting and static advantage.
I'm sure the chess AIs are full of this sort of knowledge internally, though, in the form of computation optimization algorithms. Perhaps the issue is to translate it to a human-usable format.
I've never heard experts discuss this, but I bet it's true that human beings still succeed in appreciating many of these benefits at a higher level of abstraction than machines do. An argument for this is that computers needed an extremely large advantage in explicit search depth to be able to beat human grandmasters. So the humans had other kinds of advantages going for them and most likely still do. One of those advantages that seems plausible is more sophisticated evaluation of why a position is strong or weak, without explicit game tree searches.
I looked at the Stockfish code very briefly during TCEC and it looks like a number of the evaluation heuristics that are not based on material (captures) are manually coded based on human reasoning about chess positions. But if I understood correctly, they are also running machine learning with huge numbers of simulated games in order to empirically reweight these heuristics, so if a particular heuristic turns out to help win games, it can be assessed as more valid/higher priority.
You could imagine that there are some things that human players know tacitly or explicitly that Stockfish or other engines still have no representation of at all, and they might contribute quite a bit to the humans' strength.
I think one of Kasparov's games against Karpov in the New York portion of one of their World Championship matches involved Kasparov sacrificing a queen for positional compensation on the black side of a King's Indian. It would be interesting to see what this project thinks of that game.
What is a surprising move varies greatly from player to machine. Here's a good example:
http://www.chessgames.com/perl/chessgame?gid=1064780
Capa's move 10 here (Bd7) is completely surprising to the vast majority of players and computers. It breaks most of the standard 'rules' of development and space control. However, it doesn't move the needle in terms of tactical significance at all. To me, that's a surprising move.
Fischer's 17 ... Be6, for example in the Game of the Century
Or 15 ...Nf2 (again Fischer and Byrne) http://www.chessgames.com/perl/chessgame?gid=1008419&kpage=1
It might be interesting to see how many blunders this identifies compared with traditional analysis. (Looking at the "surprising bad move" vs "surprising good move")
In any case, very interesting work. Others have some good ideas for additional checks/considerations, and it would be interesting to see how this evolves!
Tal played the move 19. Rf6!!, which instantly wins the game. However, (at least when I tested this a few months ago), Stockfish takes a fairly long time to recognize this-- it prefers the more conservative 19. c4 instead.
I also would love to see some chess engine that plays ridiculous moves in the beginning to throw people off guard (i.e. increase greatly increase the variance in possible evaluations) and then crushes the opponent by playing all the computer moves while the human players have to walk on their toes in a minefield of possible blunders because the position is so wacky.
https://en.wikipedia.org/wiki/TCEC
There are other championships out there, but this is an indication that Stockfish is among the very strongest chess-playing entities in the world.
I hope i can answer some of your questions given more time but I have to say there are some very cool suggestions here and in the reddit thread which i have to keep in mind.
Like you I've noticed that often when looking at Engine Analysis the obvious human move doesn't appear as one of the first choices, which usually means there is an opportunity to get the machine to show you some tactics.
So essentially your idea modulated by my assumption it would be difficult to get Stockfish to play sufficiently badly for stockfish deep plus stockfish shallow.
But anyway, congrats to you for actually getting there first and making the idea work.
Btw, I've never seen Rxd4!! from Kasparov-Topalov described as a "natural" move. I'm guessing the author meant "unnatural". :)
Well yeah, I could also add a rubiks cube to the white pieces.
The thought is like the following: people actually compose chess puzzles for fun, without regard to them appearing in an actual game: There's chess puzzle composition competitions.
Could one write a program to make a monster puzzle (or better, the most complicated) with forced moves?
That is: maximize X in "white to move and mate in X moves" restricted to board size and standard chess rules.
Then also, maybe lines of the "Irrational system" of the French Defence, Winawer variation (lines of Qg4, and Black sacrificing both g7 and h7 pawns).
Playing with nuances about what "complicated" means, perhaps also Nimzowitsch's "Immortal Zugzwang" game, where White is absolutely helpless on an almost full board of pieces.
This is something I've thought about when looking at chess problems, whether such problems could actually occur in a real game.
I have a feeling this is often tractable, because we could probably construct a cooperative scenario involving sacrifice of arbitrary pieces at the beginning of the game (maybe via a series of knight captures?), and then the main question is confirming how particular pawns moved past each other, and finding a way of ensuring that no stalemates occurred while positioning the kings.
https://en.wikipedia.org/wiki/Chess960
(because apart from the structure part that the link you gave mentions, experts seem to know a huge amount of explicit opening theory, in terms of memorized opening lines and particular chess masters' view of their tactical consequences)
I'm getting more curious about the reachability question.
There are some discussions at
https://chess.stackexchange.com/questions/4830/how-many-lega...
https://mathoverflow.net/questions/138133/what-proportion-of...
https://www.chess.com/forum/view/general/how-many-different-...
https://en.wikipedia.org/wiki/Chess#Combinatorics_of_chess_a...
Also related:
https://en.wikipedia.org/wiki/Proof_game
That includes a retrograde solver for openings, but that's not exactly what I was envisioning -- I was thinking of a retrograde solver for endgames, which then needs something kind of akin to an inverse tablebase ("yes, this family of positions is known to be legal!" instead of "this position is a win for black").
For instance a white king on H8 and black Rooks on A7, A8 (unless I'm mistaken).
It almost seems as if it is easier to find a position that is guilty (when it is), than to check that a position has a perfect record (check that it is legal).