static void Main(string[] args)
        {
            Game game = new Game();

            game.ComputerMove();
            game.ComputerMove();
            if (PrintStatusAndReturnWhetherGameHasEnded(game))
            {
                return;
            }

            game.UserMove();
            game.UserMove();
            if (PrintStatusAndReturnWhetherGameHasEnded(game))
            {
                return;
            }

            while (true)
            {
                Console.Write("Would you like to draw another card? (Y/N) ");
                string input = Console.ReadLine();
                if (input == "Y" || input == "y")
                {
                    game.UserMove();
                    if (PrintStatusAndReturnWhetherGameHasEnded(game))
                    {
                        return;
                    }
                }
                else if (game.ComputerScore > game.UserScore)
                {
                    Console.WriteLine("Computer won :-(");
                    return;
                }
                game.ComputerMove();
                if (PrintStatusAndReturnWhetherGameHasEnded(game))
                {
                    return;
                }
            }

            //TestCardClass();
            //TestDeckClass();
            //TestGameClass();
        }
 private static void TestGameClass()
 {
     Game game = new Game();
     game.ComputerMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.UserMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.ComputerMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.UserMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.ComputerMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.UserMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.ComputerMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
     game.ComputerMove();
     PrintStatusAndReturnWhetherGameHasEnded(game);
 }
        private static void TestGameClass()
        {
            Game game = new Game();

            game.ComputerMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.UserMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.ComputerMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.UserMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.ComputerMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.UserMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.ComputerMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
            game.ComputerMove();
            PrintStatusAndReturnWhetherGameHasEnded(game);
        }
        static void Main(string[] args)
        {
            Game game = new Game();

            game.ComputerMove();
            game.ComputerMove();
            if (PrintStatusAndReturnWhetherGameHasEnded(game))
                return;

            game.UserMove();
            game.UserMove();
            if (PrintStatusAndReturnWhetherGameHasEnded(game))
                return;

            while (true)
            {
                Console.Write("Would you like to draw another card? (Y/N) ");
                string input = Console.ReadLine();
                if (input == "Y" || input == "y")
                {
                    game.UserMove();
                    if (PrintStatusAndReturnWhetherGameHasEnded(game))
                        return;
                }
                else if (game.ComputerScore > game.UserScore)
                {
                    Console.WriteLine("Computer won :-(");
                    return;
                }
                game.ComputerMove();
                if (PrintStatusAndReturnWhetherGameHasEnded(game))
                    return;
            }

            //TestCardClass();
            //TestDeckClass();
            //TestGameClass();
        }
Exemplo n.º 5
0
 private void ComputerMove()
 {
     ComputerCards.Children.Add(GetImageForCard(_game.ComputerMove()));
     ComputerScore.Text = _game.ComputerScore.ToString();
 }