fullName method
override
Describe the Hand (we expect every implementor to override this).
Implementation
@override
String fullName() {
List<String> r1 = ranks.map((r) => r.name).toList();
List<String> r2 = ranks.map((r) => r.plural).toList();
List<String> r3 = ranks.map((r) => r.article).toList();
switch (level) {
case HandLevelHigh.StraightFlush:
if (ranks[0] == Rank.Ace) {
return "royal flush";
}
return "${r1[0]}-high straight flush";
case HandLevelHigh.Quads:
return "four ${r2[0]} with ${r3[4]} ${r1[4]}";
case HandLevelHigh.FullHouse:
return "${r2[0]} full of ${r2[3]}";
case HandLevelHigh.Flush:
return "flush: ${r1[0]}, ${r1[1]}, ${r1[2]}, ${r1[3]}, ${r1[4]}";
case HandLevelHigh.Straight:
return "${r1[0]}-high straight";
case HandLevelHigh.Trips:
return "three ${r2[0]}, ${r1[3]}, ${r1[4]}";
case HandLevelHigh.TwoPair:
return "${r2[0]} and ${r2[2]} with ${r3[4]} ${r1[4]}";
case HandLevelHigh.Pair:
return "pair of ${r2[0]}, ${r1[2]}, ${r1[3]}, ${r1[4]}";
default:
assert(level == HandLevelHigh.NoPair);
return "no pair: ${r1[0]}, ${r1[1]}, ${r1[2]}, ${r1[3]}, ${r1[4]}";
}
}