Beispiel #1
0
        private void SetUpStandardGame(Grid playerGrid, Grid enemyGrid)
        {
            var playerShips = _shipService.Get();
            var enemyShips  = _shipService.Get();

            bool autoPositionShips = RequestBool("Position ships randomly:");

            if (autoPositionShips)
            {
                foreach (Ship playerShip in playerShips)
                {
                    _gridService.SetShipPosition(playerGrid, playerShip);
                }
            }
            else
            {
                foreach (Ship playerShip in playerShips)
                {
                    SetShipPositionManually(playerGrid, playerShip);
                }
            }

            foreach (Ship enemyShip in enemyShips)
            {
                _gridService.SetShipPosition(enemyGrid, enemyShip);
            }

            Console.WriteLine();
            DrawGrid(playerGrid, "Positioning");
        }