3 ms·
I recently wrote a Haskell module [1] for computing with so-called Rankings, which I formalize as a triple consisting of a size, an unrank function that maps in
by tromp 4y ago
I recently wrote a Haskell module [1] for computing with so-called Rankings, which I formalize as a triple consisting of a size, an unrank function that maps integers in the range 0..size-1 to objects, and a rank function that maps objects to integers.
A similar Haskell module [2] was written by Brent Yorgey.
The multinomialRanking function in my module generalizes the binomial rankings considered in the article, as well as permutations. By composing all kinds of rankings together, some very interesting classes of objects can be enumerated.
Even very densely coded chess positions; by nesting 14 different rankings, I obtained a ranking of size ~ 8.7x10^45 that includes all legal chess positions.
Sampling millions of random chess positions [3] and determining their legality [4] allowed us to estimate the number of legal chess positions as ~ 4.8 * 10^44.
[1] https://github.com/tromp/ChessPositionRanking/blob/main/src/Data/Ranking.hs https://github.com/tromp/ChessPositionRanking/blob/main/src/...
[2] https://hackage.haskell.org/package/simple-enumeration-0.2/docs/Data-Enumeration-Invertible.html https://hackage.haskell.org/package/simple-enumeration-0.2/d...
[3] https://github.com/tromp/ChessPositionRanking https://github.com/tromp/ChessPositionRanking
[4] https://github.com/peterosterlund2/texel/blob/master/doc/proofgame.md https://github.com/peterosterlund2/texel/blob/master/doc/pro...
- thfuran 4y agoAre there any legal chess positions that cannot be arrived at by a legal move from a legal position?
- anonymoushn 4y ago"legal chess position" is probably defined in terms of being able to arrive at it by legal moves from legal positions.
- tromp 4y agoA legal position is any position reachable from the starting position by a valid game of chess, i.e. a sequence of legal moves. Thus there are no such positions. Every legal position can be arrived at by playing a legal move from another legal position. That includes the starting position, since Nf3 Nf6 Ng1 Ng8 cycles back to it.
- mdiesel 4y agoI guess what the question is, is whether there's a chess position where every piece is in a legal position, but could never be achieved in practice. I can think of several, for example if you had all 32 pieces on the board, but pawns were behind each other on the same file.
- deleted 4y ago[deleted]
- tromp 4y agoThat's not a legal position, since it cannot be reached in a valid game of chess. What do you mean by a piece being in a legal position? A position involves placement of all pieces, as well as turn to move, castling rights, and en-passent capturabililty.