Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 public function isKingAttacked(Player $player)
 {
     return in_array($player->getKing()->getSquareKey(), $this->getPlayerControlledKeys($player->getOpponent(), false));
 }