i'm almost done with my video poker game. i need help finding the if the winning hand is a straight(a straight is five continous cards e.g. 3,4,5,6,7, ive made J,Q,K,A 11-14) HERE'S
A CODE SNIPPET:
int[] arraydeck = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13","14"};
string[] arraysuit = { "♠ ", "♦ ", "♣ ", "♥ " };
hasstraight(arraydeal);
//I PLACED RANDOM CARD GENERATOR CODE HERE
void hasstraight(int[] straight)
{
txtHand.Text = "";
int[] straight2 = new int[straight.Length];
for (int i = 0; i < straight2.Length; i++)
{
Array.Sort(straight2);
//txtHand.Text += straight2[i].ToString() + ", ";
}
int recrank = straight2[0];
for (int i = 0; i < straight2.Length; i++)
{
int recrank2 = straight2[i];
//textBox1.Text += recrank2.ToString();
if (recrank != recrank2++)
{
txtStraight.Text= " ";
}
else
{
txtStraight.Text = "STRAIGHT!";
}
recrank++;
}
}
this works on (4,5,6,7,8) but unfortunately it also calls (4,5,7,7,8) a straight. Also, how do i move the form around? When i drag the form title it does not move (i'm new to c#)
thanks.