Пример #1
0
        static void Main(string[] args)
        {
            //start game
            NoThanks newGame = new NoThanks();

            Console.ReadLine();
        }
Пример #2
0
        //Display the totals for every player: list of cards, number of tokens
        //Announce scores, with 1st place, 2nd place, etc
        //Stop the turns, tally up the scores, display the tallies and declare a winner
        //Then terminate the game or ask if you want to play again
        public void endGame()
        {
            gameOver = true;
            Console.WriteLine("\n\n\n\n\n" + Methods.largeBreak + "\nGAME OVER\n" + Methods.largeBreak + "\n\n\n");
            for (int i = 0; i < players.Length; i++)
            {
                players[i].CalculateScore();
            }
            endGameDisplay();
            Player winner = players[0];

            for (int i = 1; i < players.Length; i++)
            {
                if (players[i].Score < winner.Score)
                {
                    winner = players[i];
                }
            }
            Console.WriteLine(Methods.largeBreak + "\nThe winner is {0} with the lowest score of {1}!", winner.Name, winner.Score);
            Console.WriteLine("Do you want to play again? [Y/N]");
            bool valid = false;

            while (!valid)
            {
                string newGame = Console.ReadLine().ToLower();
                if (newGame.Equals("y"))
                {
                    valid = true;
                    Console.WriteLine("\n\n\n");
                    NoThanks game = new NoThanks();
                }
                else if (newGame.Equals("n"))
                {
                    Console.WriteLine("Thanks for playing!");
                    valid = true;
                }
                else
                {
                    Console.WriteLine("Please enter [Y]es or [N]o.");
                }
            }
        }