コード例 #1
0
ファイル: Generator.php プロジェクト: Austin-Pray/lichess
 /**
  * Creates a return game for the given player,
  * reverting players colors
  *
  * @param  Player the player who creates the return game
  * @return Player the new player on the new game
  **/
 public function createReturnGame(Player $player)
 {
     $nextGame = $this->createGame();
     $nextPlayer = $nextGame->getPlayer($player->getOpponent()->getColor());
     $nextGame->setCreator($nextPlayer);
     $player->getGame()->setNext($nextGame->getHash());
     return $nextPlayer;
 }
コード例 #2
0
ファイル: Analyser.php プロジェクト: Austin-Pray/lichess
 public function isKingAttacked(Player $player)
 {
     return in_array($player->getKing()->getSquareKey(), $this->getPlayerControlledKeys($player->getOpponent(), false));
 }