Example #1
0
        private void CheckResult()
        {
            if (player1 != player2)
            {
                if (player1Score > player2Score)
                {
                    Console.WriteLine("Player1 won round" + (index + 1));
                    WriteToDisk.AddOutput(index, WinState.PLAYER1);
                    player1FinalScore++;
                }

                else if (player1Score < player2Score)
                {
                    Console.WriteLine("Player2 won round" + (index + 1));
                    WriteToDisk.AddOutput(index, WinState.PLAYER2);
                    player2FinalScore++;
                }

                else if (player1Score == player2Score)
                {
                    Console.WriteLine("Draw round" + (index + 1));
                    WriteToDisk.AddOutput(index, WinState.TIE);
                    draw++;
                }
            }
        }
Example #2
0
        public CardSet player2; // Result

        static void Main()
        {
            for (int i = 0; i < 1000; i++)
            {
                Program program = new Program();
                program.GetGame();
                program.GetCardValues(currentCardsPlayer1, player1FinalCards, player1RemainingCards);
                program.GetCardValues(currentCardsPlayer2, player2FinalCards, player2RemainingCards);
                program.PrintSomeStuff();
                program.CheckHighCardResult();
                program.CheckResult();
                Console.WriteLine("________________________________________\n");
                program.ResetData();

                index++;
            }
            PrintResult();
            WriteToDisk.WriteRoundToDisk();
        }
Example #3
0
 public void CheckHighCardResult()
 {
     if (player1 == CardSet.HIGH_CARD && player2 == CardSet.HIGH_CARD)
     {
         if (CombiCheck.CheckHighestCard(player1FinalCards) > CombiCheck.CheckHighestCard(player2FinalCards))
         {
             Console.WriteLine("Player1 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER1);
             player1FinalScore++;
         }
         else if (CombiCheck.CheckHighestCard(player1FinalCards) < CombiCheck.CheckHighestCard(player2FinalCards))
         {
             Console.WriteLine("Player2 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER2);
             player2FinalScore++;
         }
         else
         {
             Console.WriteLine("Draw round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.TIE);
             draw++;
         }
     }
     else if (player1 == CardSet.ONE_PAIR && player2 == CardSet.ONE_PAIR)
     {
         if (CombiCheck.CheckHighestCard(Player1Pairs) > CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player1 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER1);
             player1FinalScore++;
         }
         else if (CombiCheck.CheckHighestCard(Player1Pairs) < CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player2 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER2);
             player2FinalScore++;
         }
         else
         {
             Console.WriteLine("Draw round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.TIE);
             draw++;
         }
     }
     else if (player1 == CardSet.TWO_PAIR && player2 == CardSet.TWO_PAIR)
     {
         if (CombiCheck.CheckHighestCard(Player1Pairs) > CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player1 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER1);
             player1FinalScore++;
         }
         else if (CombiCheck.CheckHighestCard(Player1Pairs) < CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player2 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER2);
             player2FinalScore++;
         }
         else
         {
             Console.WriteLine("Draw round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.TIE);
             draw++;
         }
     }
     else if (player1 == CardSet.THREE_OF_A_KIND && player2 == CardSet.THREE_OF_A_KIND)
     {
         if (CombiCheck.CheckHighestCard(Player1Pairs) > CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player1 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER1);
             player1FinalScore++;
         }
         else if (CombiCheck.CheckHighestCard(Player1Pairs) < CombiCheck.CheckHighestCard(Player2Pairs))
         {
             Console.WriteLine("Player2 won round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.PLAYER2);
             player2FinalScore++;
         }
         else
         {
             Console.WriteLine("Draw round " + (index + 1));
             WriteToDisk.AddOutput(index, WinState.TIE);
             draw++;
         }
     }
 }