title: c# console dice roll
body: <p>I am having problems with a program. I need to compare the number of combinations, if they are the same, the higher value wins. Else if the number of combinations are the same and the value are the same, it is a tie. here what I have so far.</p>
  
  <pre><code>        int[] player1 = new int[6];
          int[] player2 = new int[6];
  
          Random rndGen = new Random();
  
          for (int i = 0; i &lt; 5; i++)
          {
              int diceRoll = 0;
  
              diceRoll = rndGen.Next(6);
              player1[diceRoll]++;
              Console.WriteLine("Computer rolled: {0}", diceRoll + 1);
  
          }//end for
  
          for (int i = 0; i &lt; 5; i++)
          {
              int diceRoll = 0;
              diceRoll = rndGen.Next(6);
              player2[diceRoll]++;
              Console.WriteLine("You rolled: {0}", diceRoll + 1);
  
          }//end for
  
          int maxPlayer1 = 0, maxPlayer2 = 0;
          for (int i = 1; i &lt; 5; i++)
          {
              if (player1[i] &gt; player1[maxPlayer1]) maxPlayer1 = i;
              if (player2[i] &gt; player2[maxPlayer2]) maxPlayer2 = i;
          }//end for
  
          if (player1[maxPlayer1] &gt; player2[maxPlayer2])
              Console.WriteLine("Computer won with {0} of a kind", player1[maxPlayer1], maxPlayer1 + 1);
          else
              if (player2[maxPlayer2] &gt; player1[maxPlayer1])
                  Console.WriteLine("You won with {0} of a kind", player2[maxPlayer2], maxPlayer2 + 1);
              else
                  Console.WriteLine("Tie");
  
      }//end main
  }
  </code></pre>
  
  <p>}</p>