Exemplo n.º 1
0
        public IEnumerable <IShipPosition> GetShipPositions()
        {
            lastTarget = null; // Forget all our history when we start a new game

            List <Ship> allianceFleet = new List <Ship>();

            allianceFleet.Add(new Carrier());
            allianceFleet.Add(new Battleship());
            allianceFleet.Add(new Destroyer());
            allianceFleet.Add(new Frigate());
            allianceFleet.Add(new PatrolBoat());

            foreach (Ship ship in allianceFleet)
            {
                ourBoard.AddShipToRandomPosition(ship);
            }

            List <IShipPosition> shipPositions = new List <IShipPosition>();

            foreach (Ship ship in allianceFleet)
            {
                shipPositions.Add(ship.GetPosition());
            }

            return(shipPositions);
        }