예제 #1
0
        void PlayTheGame(WarCardGame war)
        {
            war.StartNewGame();

            while (!war.EndOfGame())
            {
                war.NextCard();
            }

            if (war.p1.cards.Count == 0)// COME BACK HERE WHEN YOU RE DONE
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("{0} HAS WON  {1}", war.p2.name, war.p2.cards.Count);
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("{0} HAS LOST {1}", war.p1.name, war.p1.cards.Count);
                Console.ResetColor();
            }
            else if (war.p2.cards.Count == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("{0} HAS WON {1}", war.p1.name, war.p1.cards.Count);
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("{0} HAS LOST {1}", war.p2.name, war.p2.cards.Count);
                Console.ResetColor();
            }
        }
예제 #2
0
        void Start()
        {
            Player player1 = new Player("John");
            Player player2 = new Player("Emma");

            WarCardGame war = new WarCardGame(player1, player2);

            PlayTheGame(war);
        }
예제 #3
0
        void PlayTheGame(WarCardGame war)
        {
            war.StartNewGame();

            while (!war.EndOfGame())
            {
                war.NextCard();

                //adds delay between each loop
                //System.Threading.Thread.Sleep(400);
            }
        }
예제 #4
0
        void Start()
        {
            Player player1 = new Player("Emre");
            Player player2 = new Player("Ege");

            //create game and play it

            WarCardGame war = new WarCardGame(player1, player2);

            PlayTheGame(war);
            Console.ReadKey();
        }