Compare 2 int array which is the biggest
Hi guys I am creating a card game specifically a poker card game I am already on the chapter where in to determine who's the winner but having trouble doing it on the TIE part
if(Player1 > Player2)
{
checkHand.text = "Player 1 Wins";
}
else if(Player1 < Player2)
{
checkHand.text = "Player 2 Wins";
}
else
{
//Means Tie
//So let's check the value of each players cards
//Combine Arrays of cards and player
var player1Array = cardplaceholderValue.Concat(p1val).ToArray();
var player2Array = cardplaceholderValue.Concat(p2val).ToArray();
//Converting string array to int array
var player1Convert = player1Array.Select(int.Parse).ToArray();
var player2Convert = player2Array.Select(int.Parse).ToArray();
//sort to ascending
var player1 = player1Convert.OrderBy(n => n).ToArray();
var player2 = player2Convert.OrderBy(n => n).ToArray();
}
Let's say that I have a two pairs for both player1 and player2 which has this value
5 Cards on Table = { 3,4,5,7,8 } Player 1 = { 3, 5} Player 2 = {5, 8}
Clearly the winner must be Player2 because it got {5,5,8,8} while Player1 has only {3,3,5,5} Pairs
Comment
Your answer
Follow this Question
Related Questions
C# noob question (array realated) 1 Answer
Modify Array in Editor Window - 2020+ 0 Answers
Index out of range error 1 Answer