}
if (((PokerPlayer)players.get(first)).hasFolded())
GameContext.log(0, "All players have folded. That was dumb. The winner will be random.");
Hand bestHand = ((PokerPlayer) players.get(first)).getHand();
PokerHandScorer scorer = new PokerHandScorer();
HandScore bestScore = scorer.getScore(bestHand);
// find the best hand
for (int i = first + 1; i < players.size(); i++) {
PokerPlayer player = (PokerPlayer) players.get(i).getActualPlayer();
HandScore score = scorer.getScore(player.getHand());
if (!player.hasFolded() && score.compareTo(bestScore) > 0) {
bestScore = score;
}
}
// find all players with a hand that good (rare that there will be more than one
for (int i = first; i < players.size(); i++) {
PokerPlayer player = (PokerPlayer) players.get(i).getActualPlayer();
if (!player.hasFolded() && scorer.getScore(player.getHand()).compareTo(bestScore) == 0) {
winners.add(player);
}
}
GameContext.log(0, "The winning players were " + winners);