import Foundation typealias Trick = [Card] extension Trick { func winnerIndex(forGameType type: GameType) -> Int { let highCard = Dealer.sort(cards: self, using: type.sortingType).first! return firstIndex(of: highCard)! } var points: Int { map { $0.points } .reduce(0, +) } }