/**
  * @param Battlefield $battlefield
  * @param int         $path
  * @param string      $coordinate
  *
  * @return Cell
  * @throws CellException
  */
 protected function processPath(Battlefield $battlefield, int $path, string $coordinate) : Cell
 {
     $processor = (new PathProcessor($coordinate))->setPath($path);
     while (null !== ($cell = $battlefield->getCellByCoordinate($processor->calculateNextCoordinate()))) {
         if ($cell->hasFlag(CellModel::FLAG_DEAD)) {
             if ($cell->hasFlag(CellModel::FLAG_SHIP)) {
                 continue;
             }
             /** if it is not dead ship - terminate processing */
             throw new CellException("cell: {$cell->getId()} already dead and is not ship");
         }
         return $cell;
     }
     throw new CellException("unable to find cell using path: {$path} from coordinate: {$coordinate}");
 }
 /**
  * @see GameProcessor::processPlayerTurnOnBattlefield
  *
  * @param Battlefield $battlefield
  * @param Player      $attacker
  *
  * @return bool
  * @throws GameProcessorException
  */
 private function processPlayerTurnOnBattlefield(Battlefield $battlefield, Player $attacker)
 {
     return $this->invokeMethod(static::$gameProcessor, 'processPlayerTurnOnBattlefield', [$battlefield, $attacker, $battlefield->getCellByCoordinate('A1')]);
 }
 /**
  * @since 19.0
  *
  * @param Battlefield $battlefield
  *
  * @return Cell
  * @throws CellException
  */
 protected function findCellByCurrentCoordinate(Battlefield $battlefield) : Cell
 {
     if (null !== ($cell = $battlefield->getCellByCoordinate($this->currentCoordinate))) {
         return $cell;
     }
     throw new CellException("{$battlefield->getId()} do not contain cell with coordinate: {$this->currentCoordinate}");
 }