Is there a free online website that attempts to generate "legal" random chess setups X amount of moves into the game?
-
1I'm curious why you would find such a tool useful– Valentin BrassoCommented May 18, 2012 at 17:51
-
@altvali: No reason.– blundersCommented May 18, 2012 at 18:08
-
How random do you want them ? Equiprobable ? Do you need a series of moves to lead to that position ? If that's random, what sense does “X moves into the game” exactly make ? In what format do you want the result ? (FEN, diagram, series of moves…)– Nikana ReklawyksCommented Dec 8, 2012 at 14:42
7 Answers
I stumbled upon Chess Hero. It looks very nice, but it is not online. Per the website:
- You supply a set of PGN files
- The program picks random positions from the PGN files and challenges you to guess the best move computed by a chess engine
- On every attempt you are given a penalty (the difference in score between your move and the engine best)
The software can be found here.
-
+1 @xaisoft: Interesting, wonder why someone would build a system that's not online. Anyway, as you might guess, this is not really the problem I'm attempting to solve, that being a point-based guess the next move based on archival PGN files; though weighting the random selection of a move on a scale of best to worst was a more advance feature I'd hoped for in the "random opening" game; meaning that you would handicap one-sides opening in a semi-random, yet statistically weighted way.– blundersCommented May 19, 2012 at 2:13
Find an online database of games. Choose a random game and a random move in that game. Voila, an instant realistic and legal position.
-
It's not the same thing, meaning while it's possible the select of the game, and the point within it might be selected randomly -- the openings would not be random. That said, I realize now that the use of "natural" in the body of the question was confusing, so I've replaced it with legal. Also, might note that currently the answer posted by me covers roughly, if not exactly the method of board generation I'm talking about. Thanks of the suggestion, and I agree that if attempt to select a randomly select a "natural" game it'd be the way to go.– blundersCommented May 18, 2012 at 21:31
-
2If that's all you need, then what you're talking about would be pretty easy to write. Given that what we're talking about seems useless, I doubt it exists on the web anywhere. Commented May 18, 2012 at 23:58
-
So, you're saying that using stats from chess opening explorer would be more useful (which is likely true), but I'm saying my way would be more fun, and lead to more creative games.– blundersCommented May 19, 2012 at 0:32
-
1@blunders no, I'm saying that if you want realistic positions, pulling them from real games would be easy. If you want random positions, generating them randomly would be easy. Commented May 19, 2012 at 0:44
I've actually programmed precisely that in PHP to test a hypothesis two days ago. If you're interested, I've uploaded the code to github for you: https://github.com/dennisvink/php-random-chess-move-generator
I was unable to find an online tool to do this, but in terms of how, the following appears to be the logic that would be used:
- Both white and black pieces would be in the correct starting positions;
- White would start;
- Turns following white's start would be exchanged between white and black;
- Any piece able to move during a turn would be a member of the list of pieces to be randomly selected to move;
- Once a piece was selected, all squares for that piece that are legal moves would be added to the list of possible moves, and a move would be selected randomly from that list;
- Attacks would not take place unless the attack was randomly selected as a move. If an attack does take place, then the attacked pieced would be removed from the board.
- Iterations of randomly selected moves would stop once the number of moves into the game set before generating the board had been reached.
-
I was searching for this as well and was unable to find something that was automatic.– xaisoftCommented May 18, 2012 at 17:57
-
@xaisoft: Clearly me either, though I haven't seen a name for this chess variant either, which would likely help. As you likely know, Fischerandom chess is related, here's a tool that generates setups.– blundersCommented May 18, 2012 at 18:11
Besides the two ways already mentioned:
- Pick a random position from a database.
- Play a random amount of random moves.
We should also mention the most simple:
- Generate a totally random position. Validate it. If not legal repeat.
You should be able to find lots of tools for analyzing if a position is legal. (E.g. exactly one king on each side etc.)
How about using live games from lichess? Here is an example call to the server. See the docs for pulling a list of users currently playing.
I think Lichess training do just that. It's software take a game position from it's database and challenge you to pick the best one based on Stockfish analysis.