コード例 #1
0
ファイル: Stupid.php プロジェクト: hafeez3000/lichess
 public function move(Game $game, $level)
 {
     $analyser = new Analyser($game->getBoard());
     $moveTree = $analyser->getPlayerPossibleMoves($game->getTurnPlayer());
     // choose random piece
     do {
         $from = array_rand($moveTree);
     } while (empty($moveTree[$from]));
     // choose random move
     $to = $moveTree[$from][array_rand($moveTree[$from])];
     return $from . ' ' . $to;
 }