Example #1
0
 /**
  * @return Player
  */
 public function getInvited()
 {
     if (!$this->creator) {
         return null;
     }
     if ($this->creator->isWhite()) {
         return $this->getPlayer('black');
     }
     return $this->getPlayer('white');
 }
Example #2
0
 /**
  * Tell whether or not this player can castle queen side
  *
  * @return bool
  **/
 public function canCastleQueenSide(Player $player)
 {
     return $this->canCastle($player->getKing(), -4);
 }
Example #3
0
 /**
  * @return Player
  */
 public function createPlayer($game, $color)
 {
     $player = new Player($color);
     $player->setGame($game);
     $player->setPieces($this->createPieces($player));
     return $player;
 }
Example #4
0
 /**
  * Get the socket file
  *
  * @return string
  **/
 public function getFile(Player $player)
 {
     return $this->dir . '/' . $player->getFullHash() . '.json';
 }
Example #5
0
 public function update(Player $player)
 {
     $player->setTime(time());
 }
Example #6
0
 public function getGame()
 {
     return $this->player->getGame();
 }