Exemplo n.º 1
0
        public void StartGame()
        {
            Console.WriteLine("{0} game started. Good luck!", _difficulty);
            _board = new Board(_difficulty);
            _ships = new List <IShip>();
            switch (_gameMode)
            {
            case "unlimited":
                switch (_difficulty)
                {
                default:
                case "easy":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _boardShipsHealth = TotalShipHealth();
                    EasyModeTakeGuesses();
                    break;

                case "medium":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _boardShipsHealth = TotalShipHealth();
                    EasyModeTakeGuesses();
                    break;

                case "hard":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _boardShipsHealth = TotalShipHealth();
                    EasyModeTakeGuesses();
                    break;

                case "very hard":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new LargeShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _boardShipsHealth = TotalShipHealth();
                    EasyModeTakeGuesses();
                    break;
                }
                break;

            case "limited":
                switch (_difficulty)
                {
                default:
                case "easy":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _player = new Player
                    {
                        NumberOfTurns = 20
                    };
                    _boardShipsHealth = TotalShipHealth();
                    TakeGuesses();
                    break;

                case "medium":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _player = new Player
                    {
                        NumberOfTurns = 30
                    };
                    _boardShipsHealth = TotalShipHealth();
                    TakeGuesses();
                    break;

                case "hard":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _player = new Player
                    {
                        NumberOfTurns = 40
                    };
                    _boardShipsHealth = TotalShipHealth();
                    TakeGuesses();
                    break;

                case "very hard":
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new SmallShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new MediumShip());
                    _ships.Add(new LargeShip());
                    _board.Draw();
                    _board.PlaceShips(_ships);
                    _player = new Player
                    {
                        NumberOfTurns = 60
                    };
                    _boardShipsHealth = TotalShipHealth();
                    TakeGuesses();
                    break;
                }
                break;
            }
        }