Beispiel #1
0
        // Player Turn
        public static void PlayerTurn(Player player1, Player player2)
        {
            Console.Write("\n\n");
            Console.WriteLine("Cards left in the deck: {0}", deck.GetCardsLeft()); // Prints cards left in deck
            Console.WriteLine();
            DisplayPlayerInfo(player1);
            Console.WriteLine();

            if (player1.Num_Of_Books >= 7 || player2.Num_Of_Books >= 7)
            {
                return;
            }

            Faces face = ChooseFace(player1);

            while (player1.AskForCards(player2, face)) // While AskForCards() returns true
            {
                Console.WriteLine();
                DisplayFaceTakenFrom(player1, player2, face);
                Console.WriteLine("\n");
                DisplayPlayerInfo(player1);
                Console.WriteLine("\n");

                if (player1.Num_Of_Books >= 7 || player2.Num_Of_Books >= 7)
                {
                    return;
                }

                face = ChooseFace(player1);
            }

            // GoFish() if AskForCards() returns false
            Console.WriteLine();
            GoFish(player1, player2, face);
            Console.WriteLine("\n");
            DisplayPlayerInfo(player1);

            if (player1.Num_Of_Books >= 7 || player2.Num_Of_Books >= 7)
            {
                return;
            }
        }
Beispiel #2
0
        // CPU Turn
        public static void CPUTurn(Player cpu, Player player)
        {
            Console.Write("\n\n");
            Console.WriteLine("Cards left in the deck: {0}", deck.GetCardsLeft());
            Console.WriteLine();
            DisplayPlayerInfo(cpu);

            if (cpu.Num_Of_Books >= 7 || player.Num_Of_Books >= 7)
            {
                return;
            }

            int   n    = cpu.Num_Of_Cards - 1;
            Faces face = cpu.GetCardAtIndex(n).Face;

            DrawCardIfHandIsEmpty(cpu);

            while (cpu.AskForCards(player, face))
            {
                Console.WriteLine();
                DrawCardIfHandIsEmpty(cpu);
                DisplayFaceTakenFrom(cpu, player, face);
                Console.WriteLine();
                DisplayPlayerInfo(cpu);
                Console.WriteLine();

                if (cpu.Num_Of_Books >= 7 || player.Num_Of_Books >= 7)
                {
                    return;
                }

                n    = 0;
                face = cpu.GetCardAtIndex(n).Face;
            }

            Console.WriteLine();
            GoFish(cpu, player, face);
            Console.WriteLine("\n");
        }