tracks/swift/exercises/poker/Sources/PokerExample.swift in trackler-2.2.1.175 vs tracks/swift/exercises/poker/Sources/PokerExample.swift in trackler-2.2.1.176

- old
+ new

@@ -66,13 +66,13 @@ for each in ranks { if rankSet.contains(each) { toReturn[each] = (toReturn[each] ?? 0) + 1 } } - let result = toReturn.map({ key, value in return (rank:key, count:value) }).sorted(by: { (one, two) in + let preresult = toReturn.map({ key, value in return (rank:key, count:value) }) + return preresult.sorted(by: { (one, two) in return one.count == two.count ? one.rank > two.rank : one.count > two.count }) - return result } static func isFlush(_ inputHand: PokerHand) -> (bool: Bool, suit: Suit) { let suits = inputHand.hand.map({ $0.suit }) let first = suits[0]