/** * @param Battlefield $battlefield * * @return Cell * @throws AIException * @throws CellException */ public function processCPUTurn(Battlefield $battlefield) : Cell { $cells = $this->strategyService->chooseCells($battlefield); try { return self::pickCellToAttack($cells); } catch (CellException $e) { $cells = BattlefieldModel::getLiveCells($battlefield); return self::pickCellToAttack($cells); } }
/** * @see AIStrategyService::chooseCells * @test */ public function chooseCellsOnNoDeadCellsInBattlefield() { $this->assertEmpty(static::$aiStrategyService->chooseCells(MockFactory::getBattlefieldMock())); }