133 points · by tromp · 5y ago · 97 comments
> They're all legal.
But then, looking at the final position[1], black is in check by the knight on b2. If white's pawn can be captured en passant, this implies the knight was not the most recent move, so the black king was in check on the previous turn as well.
It's obviously not legal to remain in check. What am I missing?
[1] https://raw.githubusercontent.com/tromp/ChessPositionRanking...
I missed something, and clearly misclassified this position, leaving only 51 legal in the 1k set (and only 537 in the 10k set).
Oops. It's embarrassing since I did pay attention to the en-passant positions in the 919-93 positions not from the smaller 1k sample, such as this one: https://github.com/tromp/ChessPositionRanking/issues/916
I'll have to make some changes to my README. Meanwhile, congratulations on spotting the error. And I'll be sure to mention you in the eventual publication.
This underscores the need to back up my classification with proof games...
In fact it was closed as
https://github.com/tromp/ChessPositionRanking/issues/915
So I had classified it correctly, but only AFTER making the diagrams for the 1k sample.
That means the 538 count for the 10k sample still stands. Good. Less things to fix on the README :-)
That changes the prospective number of legal positions to 539...
[1] https://github.com/tromp/ChessPositionRanking/issues/794
It's funny-- except for Tenoke all the responses so far boil down to essentially this.
I'll try again.
Assume an alternate reality where this incredibly important rule doesn't exist. In it, the other player simply takes the king on the next turn from a neophyte who didn't realize they are still in check.
What bad things would happen as a result of the non-existence of the gratuitous rule?
And don't just speculate based on the zero cost of posting on HN. Give me the real reason based on the history of the creation of chess rules and/or the documented behavior of real chess players in history.
Number of legal Go positions https://tromp.github.io/go/legal.html
Help me out on the legality of some of these boards. I see excess pieces on many boards (for example, 2 or more queens, 4 or more knights of one color).
Are these considered legal by pawn conversion?
It's more difficult than you're thinking. If white has 6 dark squared bishops, they you know that he promoted at least 5 pawns on dark squares so one pawn must have taken a piece since it's promoting on a dark square instead of a white one. Not every board set-up will have enough missing pieces that 5 pawns can maneuver to get promoted on dark squares.
Text: https://en.chessbase.com/post/solution-to-a-truly-remarkable...
So those choices are not redundant.
https://wismuth.com/chess/statistics-games.html
Also isn’t this relatively easy if you can just waste turns (pointless moves by a Queen) while returning pieces back home?
This is fascinating because on the surface it seems very do-able but I bet the devil is in the details.
It seems the 50 move rule is probably older according to Wikipedia (1800s vs 1500s), which is kind of surprising to me, I would have expected the other way around. It's easier to keep track of "moves since last capture/pawn advance" than every board position played so far. Maybe just in theory not in practice. I am a terrible chess player.
There's also the fivefold repetition rule, which draws the game automatically.
One could further simplify the search by abstracting away from the exact location of pawns, but recording only their color and order within each file.
Many of the 381 illegal positions can be proven illegal just by absence of such proof kernels.
Proof game kernels can also guide construction of full proof games.
http://talkchess.com/forum3/viewtopic.php?f=7&t=77685&p=9051...
[1] https://hackage.haskell.org/package/simple-enumeration-0.2/d...
[2] https://byorgey.wordpress.com/2019/07/05/lightweight-inverti...
http://www.nwchess.com/articles/misc/chessic_coincidence.htm
1. compact, in that it uses a relatively narrow range of numbers.
2. efficiently computable, in that you can quickly map numbers (or preferably, thousands of them) to positions, and back.
The combination of these is what allows for estimating the number of legal positions.
You're right that counting is much easier than ranking. That's reflected in my Haskell counting program [4] being MUCH simpler and MUCH faster than the ranking program. But counting is only good for upper bounding and doesn't let you draw a random sample to determine the fraction of legal ones, as needed for estimation.
[1] https://github.com/tromp/ChessPositionRanking/blob/main/src/...
[2] https://github.com/tromp/ChessPositionRanking/blob/main/src/...
[3] https://github.com/tromp/ChessPositionRanking/blob/main/src/...
[4] https://github.com/tromp/ChessPositionRanking/blob/main/src/...
I don't think that this is true. I think that explicit enumerations are rarer than exact size computations, which are themselves rarer than asymptotic size estimations, for presumably obvious reasons; but a bijective proof (https://en.wikipedia.org/wiki/Bijective_proof) is still regarded as the gold standard in combinatorics, and as a desideratum.
Obviously the former is more fun, since you feel like you scaled the summit when you determine the exact count in all its glory.
When you can only estimate, you cannot reach the summit, only reach a little higher than the previous explorer by spending much more effort on your estimation climb. I do feel some satisfaction in having established base camp though:-)
Maybe somewhere in between the enjoyment from the computable numbers of Go and chess. There is no estimation involved there. Although there are lower bounds.
The other difference being that it's a much more esoteric subject (on account of the prevalence of the Turing Machine based definition) with a much more limited audience.
It would be interesting to define parameters for a "good move" and see how many there are, though!