/** * @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; } }
/** @return bool */ public function isEqual(Play $other) { return $this->getStone()->isEqual($other->getStone()) && $this->getSide() === $other->getSide(); }