Example #1
0
        public CardSet GetPlayer1Set()
        {
            int value;

            if (CombiCheck.ThreeOfAKind(out value, player1RemainingCards))
            {
                return(CardSet.THREE_OF_A_KIND);
            }
            else if (CombiCheck.CheckOnePair(out value, player1FinalCards, player1RemainingCards, Player1Pairs))
            {
                if (CombiCheck.CheckTwoPair(out value, player1RemainingCards, Player1Pairs))
                {
                    return(CardSet.TWO_PAIR);
                }
                return(CardSet.ONE_PAIR);
            }
            else
            {
                return(CardSet.HIGH_CARD);
            }
        }
Example #2
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++;
         }
     }
 }