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; }
public function createAiForm() { $config = new AiGameConfig(); $config->fromArray($this->configPersistence->loadConfigFor('ai')); return $this->formFactory->create(new AiGameConfigFormType(), $config); }