public static void PlaceShipRandomly(ShipModel ship) { List <int[]> positions = null; while (positions == null) { positions = ship.GetValidPositions(); if (positions != null) { foreach (var position in positions) { ShipController.PlaceShip(ship, position); } } } }