PHP code example of ryanhs / chess.php

1. Go to this page and download the library: Download ryanhs/chess.php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ryanhs / chess.php example snippets




yanhs\Chess\Chess;

$chess = new Chess();
while (!$chess->gameOver()) {
    $moves = $chess->moves();
    $move = $moves[mt_rand(0, count($moves) - 1)];
    $chess->move($move);
}

echo $chess->ascii() . PHP_EOL;