1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
int * Pairme(int cards[])
{
int i = 0; bool trips = false; bool quads = false;
int order[7] = {-1,-1,-1,-1,-1,-1,-1};
int poopy; int poopy1; int poopy2; int poopy3;
int subpoopy; int subpoopy1; int subpoopy2; int subpoopy3;
int temp; int temp1; int temp2; int temp3;
int j;
for (i = 0; i < 7; i++)
{
order[i] = cards[i];
}
int *returned;
returned = order;
for (i = 2; i < 15; i++)
{
for (j = 0; j < 6; j++)
{
poopy = returned[j];
poopy1 = returned[j + 1];
subpoopy2 = 55;
subpoopy3 = 55;
temp = returned[j];
temp1 = returned[j + 1];
temp2 = 55;
temp3 = 55;
if (j < 5)
{
temp2 = returned[j + 2];
poopy2 = returned[j + 2];
subpoopy2 = poopy2 % 100;
}
if (j < 4)
{
temp3 = returned[j + 3];
poopy3 = returned[j + 3];
subpoopy3 = poopy3 % 100;
}
subpoopy = poopy % 100;
subpoopy1 = poopy1 % 100;
if (subpoopy == i)
{
if (subpoopy == subpoopy1)
{
if (subpoopy == subpoopy2)
{
if (subpoopy == subpoopy3)
{
returned = remove(returned, j);
returned = insert(returned, temp, 0);
returned = remove(returned, j+1);
returned = insert(returned, temp1, 1);
returned = remove(returned, j+2);
returned = insert(returned, temp2, 2);
returned = remove(returned, j+3);
returned = insert(returned, temp3, 3);
quads = true;
j++;
}
else
{
if (quads == false)
{
returned = remove(returned, j);
returned = insert(returned, temp, 0);
returned = remove(returned, j+1);
returned = insert(returned, temp1, 1);
returned = remove(returned, j+2);
returned = insert(returned, temp2, 2);
trips = true;
}
}
j++;
}
else
{
if (trips == false && quads == false)
{
returned = remove(returned, j);
returned = insert(returned, temp, 0);
returned = remove(returned, j+1);
returned = insert(returned, temp1, 1);
}
if (trips == true && quads == false)
{
returned = remove(returned, j);
returned = insert(returned, temp, 3);
returned = remove(returned, j+1);
returned = insert(returned, temp1, 4);
}
}
j++;
}
}
}
}
return returned;
}
|