It's a poker game with bluetooth and I encounter some difficulties to redistribute the side pots. Does someone have any experiences with that?
for(int k = 0; k < numberOfPlayer; k++)
{
canWinSidePotUpTo[k] = -1;
}
for(int i = 0 ; i < sidePot.size(); i++) {
if (sideTempToRaiseListSorted.get(i) != sideTempToRaiseListSorted.get(i + 1)) {
for (int k = 0; k < numberOfPlayer; k++) {
print("All in ToRaiseList[" + k + "] = " + toRaiseList[k]);
print("All in TempToRaise[" + k + "] = " + tempToRaise[k]);
if (sideTempToRaiseListSorted.get(i) == max(toRaiseList) - max(tempToRaise)) {
continue;
}
if (sideTempToRaiseListSorted.get(i) == (toRaiseList[k] - tempToRaise[k])) {
canWinSidePotUpTo[k] = j;
}
if (sideTempToRaiseListSorted.get(i + 1) == (toRaiseList[k] - tempToRaise[k])) {
canWinSidePotUpTo[k] = j;
}
print("All In canWinSidePotUpTo[" + k + "] " + canWinSidePotUpTo[k] + " + i = " + i);
}
print("All In sideTempToRaiseListSorted.get(" + i + ") " + sideTempToRaiseListSorted.get(i) + " + i = " + i);
print("All In sideTempToRaiseListSorted.get(" + (i + 1) + ") " + sideTempToRaiseListSorted.get(i + 1) + " + i + 1 = " + i + 1);
}
j++;
}
The expected result is to be able to set the array canWinSidePotUpTo[player] for each player. The side pot start at index 0 and if the player can win only the pot then canWinSidePotUpTo[player] = -1. All player which are allin have canWinSidePotUpTo[player] = -1 and then canWinSidePotUpTo[player] should be set according to the stack at allin... the actual result is:
All In canWinSidePotUpTo[0] -1 + i = 1
All In canWinSidePotUpTo[1] 1 + i = 1
All In canWinSidePotUpTo[2] 1 + i = 1
All In canWinSidePotUpTo[3] -1 + i = 1
That the result for:
player:hand:stack allin
0:AA:900
1:KK:1100
2:QQ:1300
3:JJ:1500
pot = 3600
sidepot(0)= 600
sidepot(1) = 400
Flop:AKQJ9
Any help would be welcome!