I’m trying to make a simple poker hand app where users can decide which hand is the winner quickly.
This is supposed to simulate a Texas hold’em style Poker game. I only have two hands since this is my first try. Once the 5 table cards and the two cards for each player is displayed, I’m trying to get all possible hands of 5 from 7 for each player. I’m trying to create code like this using Thunkable blocks.
List<List> p1Possible = new ArrayList<>();
for (int i = 0; i < numbers.size(); i++) {
int first = numbers.get(i);
for (int j = i + 1; j < numbers.size(); j++) {
int second = numbers.get(j);
for (int k = j + 1; k < numbers.size(); k++) {
int third = numbers.get(k);
for (int l = k + 1; l < numbers.size(); l++) {
int fourth = numbers.get(l);
for (int m = l + 1; m < numbers.size(); m++) {
int fifth = numbers.get(m);
List<Integer> combination = new ArrayList<>();
combination.add(first);
combination.add(second);
combination.add(third);
combination.add(fourth);
combination.add(fifth);
p1Possible.add(combination);
}
}
}
}
}
return p1Possible;
How can I do this?
This is what I have so far, and I only see 3 combinations.
Please help me!