コード例 #1
0
ファイル: LoadGameData.php プロジェクト: hafeez3000/lichess
 protected function loadAiGame($color, $username)
 {
     $config = new AiGameConfig();
     $config->setColor($color);
     $player = $this->aiStarter->start($config);
     $game = $player->getGame();
     if ($username) {
         $this->blamePlayerWithUsername($player, $username);
     }
     $manipulator = $this->manipulatorFactory->create($game);
     if ('white' === $color) {
         $manipulator->play('d2 d4');
     } else {
         $manipulator->play('g8 h6');
     }
     return $game;
 }
コード例 #2
0
 public function createAiForm()
 {
     $config = new AiGameConfig();
     $config->fromArray($this->configPersistence->loadConfigFor('ai'));
     return $this->formFactory->create(new AiGameConfigFormType(), $config);
 }