Ejemplo n.º 1
0
        private Ship CreateShip(string input, ICoordinateBoundary cb)
        {
            var coord = cb.CoordinateFromInput(input);
            var pos   = ShipPosition.Horizontal(coord, ShipSize.Destroyer);

            return(new Ship(pos));
        }
Ejemplo n.º 2
0
        private IEnumerable <BattleCoordinate> CalculateCoordinatesWithinBoundary(ICoordinateBoundary boundary)
        {
            var coords = new List <BattleCoordinate>();

            for (int c = 0; c < boundary.ColumnValues.Count(); c++)
            {
                for (int r = 0; r < boundary.RowValues.Count(); r++)
                {
                    coords.Add(new BattleCoordinate(c, r, boundary.ColumnValues.Count(), boundary.RowValues.Count()));
                }
            }
            return(coords);
        }
Ejemplo n.º 3
0
 public TestShotStrategy(ICoordinateBoundary boundary)
 {
     this.boundary = boundary;
 }
Ejemplo n.º 4
0
 public string ToString(ICoordinateBoundary boundary) => boundary.CoordinateToString(this);
Ejemplo n.º 5
0
 public FleetBuilder(ICoordinateBoundary boundary, IRandomProvider random)
 {
     this.coordinates = CalculateCoordinatesWithinBoundary(boundary);
     this.random      = random;
 }
Ejemplo n.º 6
0
 public RandomShotStrategy(ICoordinateBoundary boundary, IRandomProvider random)
 {
     this.boundary = boundary;
     this.random   = random;
 }
 public ConsoleReadShotStrategy(ICoordinateBoundary boundary)
 {
     this.boundary = boundary;
 }