winners static method
Implementation
static List<Hand> winners(List<Hand> hands) {
hands = hands.where((h) => h.qualifiesHigh()).toList();
var highestRank = hands.map((h) => h.rank).reduce((a, b) => a > b ? a : b);
hands = hands.where((h) => h.rank == highestRank).toList();
hands = hands.where((h) {
var lose = false;
for (var hand in hands) {
lose = h.loseTo(hand);
if (lose) {
break;
}
}
return !lose;
}).toList();
return hands;
}