user38: Is there a free online website that attempts to generate "legal" random chess setups X amount of moves into the game?

user38: 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.


user1025: 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.)

user1903: 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

user70: Find an online database of games.  Choose a random game and a random move in that game.  Voila, an instant realistic and legal position.

user109: 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.

38: <p>Is there a free online website that attempts to generate "legal" random chess setups X amount of moves into the game?</p>
 38: <p>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:</p>

<ul>
<li>Both white and black pieces would be in the correct starting positions;</li>
<li>White would start;</li>
<li>Turns following white's start would be exchanged between white and black;</li>
<li>Any piece able to move during a turn would be a member of the list of pieces to be randomly selected to move;</li>
<li>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;</li>
<li>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.</li>
<li>Iterations of randomly selected moves would stop once the number of moves into the game set before generating the board had been reached.</li>
</ul>
 1025: <p>Besides the two ways already mentioned:</p>

<ol>
<li>Pick a random position from a database.</li>
<li>Play a random amount of random moves.</li>
</ol>

<p>We should also mention the most simple:</p>

<ol>
<li>Generate a totally random position. Validate it. If not legal repeat.</li>
</ol>

<p>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.)</p>
 1903: <p>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: <a href="https://github.com/dennisvink/php-random-chess-move-generator" rel="nofollow">https://github.com/dennisvink/php-random-chess-move-generator</a></p>
 70: <p>Find an online database of games.  Choose a random game and a random move in that game.  Voila, an instant realistic and legal position.</p>
 109: <p>I stumbled upon Chess Hero.  It looks very nice, but it is not online.  Per the website:</p>

<ol>
<li>You supply a set of PGN files</li>
<li>The program picks random positions from the PGN files and challenges you to guess the best move computed by a chess engine</li>
<li>On every attempt you are given a penalty (the difference in score between your move and the engine best)</li>
</ol>

<p>The software can be found <a href="http://innokuo.altervista.org/chesshero.html">here</a>.</p>
