Exemple #1
0
            public void StartMenu()
            {
                Console.WriteLine("Let's play Battleship!");
                Console.WriteLine("This is a two-player game.");
                playerA = GetPlayerName("the first player");
                playerB = GetPlayerName("the second player");
                Player player1 = new Player()
                {
                    name = playerA
                };
                Player player2 = new Player()
                {
                    name = playerB
                };

                Console.WriteLine($"The battle is on between {player1.name} and {player2.name}!");
                Player currentPlayer = CoinFlip(player1, player2);

                if (currentPlayer == player1)
                {
                    nextPlayer = player2;
                }
                else
                {
                    nextPlayer = player1;
                }
                Console.WriteLine($"We've randomly selected {currentPlayer.name} to go first. {nextPlayer.name} will go second.");
                Console.WriteLine("Hit enter to continue ... ");
                Console.ReadLine();
                Console.Clear();
                GameFlow newGame = new GameFlow();

                newGame.PlayGame(currentPlayer, nextPlayer);
            }
        static void Main(string[] args)
        {
            GameFlow play = new GameFlow();

            do
            {
                GameFlow.PlayGame();
            } while (GameFlow.PlayAgain());
        }
Exemple #3
0
        static void Main(string[] args)
        {
            GameFlow battleship = new GameFlow();

            battleship.PlayGame();
        }