Bump!
I think this could be a really cool program if one doesn't already exist!
I played a game of chess that I very much want to analyze, but I didn’t record the moves during the game, all I have is the ending position and a list of pieces captured. Is there a program or some way to use a chess engine to extrapolate possible game moves to have lead to that end game?
Theoretically I know this should be possible, I just don’t know if there are any current tools I could use to accomplish this.
Thank you so much!
There are a lot of plausible and possible move orders to get to most any given position. So, while it would be possible to generate a game that ends at the same position, it's unlikely to to be the game that was played unless you can remember at least portions of the opening and middlegame as well.
another complication is the same position can be arrived at via different move orders. example: the four pawns attack of the KID and the Mekinas attack in the Modern Benoni arrive at the same position around move seven i believe.
There are a lot of plausible and possible move orders to get to most any given position. So, while it would be possible to generate a game that ends at the same position, it's unlikely to to be the game that was played unless you can remember at least portions of the opening and middlegame as well.
I know the opening and general moves and the flow of the middle game. The idea would be to generate games that end in the same position and then manually adjust moves based on me memory until I'm confident it was the exact game played.
Bump!
I think this could be a really cool program if one doesn't already exist!
Generating the 10^20 possible games wouldn't be very useful.
With some basic inputs or filtering, the number of possible games would be drastically reduced, to potentially only a handful of possibilities
1. Limit the game to 30-100 moves
2. limit the game to not include unreasonable or "bad" moves
3. input the opening moves
etc.
Out of 10^20 possibilities, almost all of those would require very long games or illogical move orders.
another complication is the same position can be arrived at via different move orders. example: the four pawns attack of the KID and the Mekinas attack in the Modern Benoni arrive at the same position around move seven i believe.
Opening moves are unique. Outside of opening moves, most positions must be achieved in a very specific order to avoid making very illogical moves.
In opening moves, you can theoretically make certain moves in relatively arbitrary orders while still getting to the same end position without either side gaining a clear edge in the game at any one point while that position was being achieved. but once the game is underway, reaching a position without a specific order would require a very specific and logical move order to avoid making a move that gives a huge positional advantage to the other side. That is, to my knowledge, why chess engines must be programmed with specific opening sequence sets.
I suspect a super GM might have a good chance of reversing the match if there's enough left on the board. A chess engine could probably find the most likely routes to a position too but you'd need to code it yourself. Implementing that is lot more work than I think you'd want to do.
I suspect a super GM might have a good chance of reversing the match if there's enough left on the board. A chess engine could probably find the most likely routes to a position too but you'd need to code it yourself. Implementing that is lot more work than I think you'd want to do.
I have almost zero programming skills, I was just wondering if it already existed.
Bump!
I think this could be a really cool program if one doesn't already exist!
Generating the 10^20 possible games wouldn't be very useful.
With some basic inputs or filtering, the number of possible games would be drastically reduced, to potentially only a handful of possibilities
1. Limit the game to 30-100 moves
2. limit the game to not include unreasonable or "bad" moves
3. input the opening moves
etc.
Out of 10^20 possibilities, almost all of those would require very long games or illogical move orders.
The bad news is that 1% of 10^20 is 10^18
I really think that through a process of analyzing moves in batches you could babe the number of combination no longer exponential.
Essentially, find the most like path to the end from like 5 moves prior, then process a 5 move batch from there, all the way to the beginning.
I went into some more detail in a Reddit post on the same topic. I really think it is possible with dedicated programming.
how would the process account for an unknown and unknown amount of repeated moves in the sequence? in a real chess game
I went into some more detail in a Reddit post on the same topic. I really think it is possible with dedicated programming.
Eh, I guess I'll give a more detailed answer.
Endgame tablebases have an exhaustive catalogue of all possible moves (for positions with 7 or fewer pieces on the board). Every legal move is listed along with its evaluation. There are only 3 types of evaluations:
1) White mates in __# moves
2) Draw
3) Black mates in __# moves
When you use endgame tablebases as reference in your analysis, you discover that it's often the case that 5 or more moves win, 5 or more moves draw, 5 or more moves lose.
---
It's a similar case with chess engines like stockfish. Either through experience or by reading what the developers have written, you discover that evaluations have an error range of about plus or minus 0.15. Meaning an eval of 0.9 could be anywhere from -0.06 to 0.24. Chess programs are not deterministic i.e. they will give you a different evaluation in that range even when the settings, software, and hardware are identical.
In other words for engines too there is the issue of it often being the case that the top 5 moves are indistinguishable from each other.
---
Additionally, we have to widen the range of moves to include what a human is likely to play. There are currently no tools that do this.
---
In the end, you can't get around there being on the order of 5^20 possible games (and that's being quite generous). That is, 5 reasonable moves in about half of the positions of a standard length game (approximately 40 moves).
---
Frankly, I think you're either trolling, or are too new to chess to realize this is not possible... and if you're new, that's fine. It's good to ask questions, and I'm not saying it to mock you, I'm just saying I very strongly disagree, and I imagine that anyone who agrees with you is ignorant about chess on a fundamental level.
I understand your point about endgame tablebases and small increment differences between different option, but between those different options, how many would also result in the exact checkmate in question and in the same number of moves in question? Sure, 5 or more moves may win, but only 1 wins in the exact way we know the game ends. And we can automatically eliminate the draws and losses.
The evaluations error range can be similar, but those similar error range moves often have drastically different ultimate endings, out of those moves all within the same evaluation range, probably only one or two actually leads to the known end.
And again, by analyzing in batches it can potentially make it no longer exponential.
Like see my comment from the reddit post which also assumes 5 reasonable moves per position,
“If you make some assumptions, you can analyze each move or set of moves independently so that the total number of possibilities is no longer exponential.
Some premises would have to be true, like both players would have had to be very good/ideal players making the best move each time, but in such a case you could definitely work it backwards.
I elaborated what I mean in a comment above. I mean, literally look at it this way, if you input all the possible moves only a few turns before the end into a positional analysis program like the one on chess.com, it will only say that some of the moves will lead to checkmate. At many of the positions, it will say the incorrect side had a positional advantage, etc. If you then follow the ideal move sets that it outputs for each position, how many of those sets would actually lead to the checkmate, and particularly the exact checkmate in question, in only 3 turns? Probably only very few. Perhaps only one.
That’s the idea, you go back like 3 moves to where there’s only 1000 positions to analyze, determine one out of that, then do it again for the next 3 moves. With only one position being chosen each time, there would only be like ~15,000 positions to analyze in a 40 move game.
It would be an interesting experiment. Hypothetically do literally do as I said, input all possible positions 3 moves back and see how many, according to stockfish analysis, lead to the checkmate in question. I really bet it’d be only a few at most.
You could even go 5 moves back, with 5^5, that’d be only 3125 positions and you’d have much more info to go off. That’s even possible to input manually, it's such a small number. It’d be trivial for a computer.
Again, the key is running an analysis for each set of moves independently of the preceding ones.”
At this point I really think the only way to settle this is to do the experiment I described. If we do it and at 3 (or maybe 5) moves back there are only one or two reasonable endgame tablebase, then what I am saying is correct, and it’s possible, but if we do that and there are several possible endgame tablebases, then clearly it’s not possible.
I’m definitely not trolling. In science, most groundbreaking discoveries are made by people peripheral to the field they break ground
for i in range(1,5001):
print(str(int(2*i-1)) + ". Nc3 Nc6 " + str(int(2*i)) + ". Nb1 Nb8")
Is this programming for my question? I really have no idea what this means. XD
how would the process account for an unknown and unknown amount of repeated moves in the sequence? in a real chess game
Assume there's no repeated moves.
....
Some premises would have to be true, like both players would have had to be very good/ideal players making the best move each time, but in such a case you could definitely work it backwards.
...
That's an unrealistic premise. Even the top players don't make the best move each time and the farther you go back there are enough good moves that you can't know what path was taken to get there.
You can probably accurately go back a few ply, only knowing the final position. After that, you can create a plausible game, but the odds of it being the game played are extremely unlikely.
For a game that you played, you may be able to do better, as you'll be able to remember some positions, some combinations, and the opening moves.
I played a game a couple of weeks ago, where I kind of remember the opening, have a couple of images from the late middle game and could likely construct the the final position as well (using those as guides). I might be able to get 85% of the game reconstructed but would likely mess up some move orders and not be able to figure a few out at all, having to make up a reasonable set of lines.
That's with more than just the end position.
Yes you can narrow that down when placing other pieces on the board, but then each of those pieces similarly explodes to cover nearly every square on the board.
In other words, reducing the number of possible positions by a factor of 1 million (as a random example) is not nearly enough. These numbers explode exponentially in just a few moves with just a few pieces, even when the piece is relatively immobile (the king).
Yes, each turn explodes exponentially, definitely, but the point is that if we can determine one necessary position after a set of 3-5 moves then the exponential "explosion" stops there.
So if there are 100 possible moves per turn, after 5 moves that would be 100^5 positions, which a computer could calculate in just a few minutes. Then, you just repeat the process in sets of 5 moves until you reach the opening.
In a 40 move game, it would be around (8(100^5)) total positions to calculate, not that many for a computer.
I played a game of chess that I very much want to analyze, but I didn’t record the moves during the game, all I have is the ending position and a list of pieces captured. Is there a program or some way to use a chess engine to extrapolate possible game moves to have lead to that end game?
Theoretically I know this should be possible, I just don’t know if there are any current tools I could use to accomplish this.
Thank you so much!