コード例 #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++;
                }
            }
        }
コード例 #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++;
         }
     }
 }