예제 #1
0
 /**
  * @param Play $play
  */
 public function play(Play $play)
 {
     if (!$this->hasStone($play->getStone())) {
         throw new InvalidMoveException('player does not have stone');
     }
     try {
         $this->removeStone($play->getStone());
         $this->game->addMove($this, $play);
     } catch (InvalidMoveException $e) {
         $this->addStones([$play->getStone()]);
         throw $e;
     }
 }
예제 #2
0
 /** @return bool */
 public function isEqual(Play $other)
 {
     return $this->getStone()->isEqual($other->getStone()) && $this->getSide() === $other->getSide();
 }