17 lines
322 B
Swift
17 lines
322 B
Swift
import Foundation
|
|
|
|
typealias Trick = [Card]
|
|
|
|
extension Trick {
|
|
|
|
func winnerIndex(forGameType type: GameType) -> Int {
|
|
let highCard = sorted(cardOrder: type.sortingType).first!
|
|
return firstIndex(of: highCard)!
|
|
}
|
|
|
|
var points: Int {
|
|
map { $0.points }
|
|
.reduce(0, +)
|
|
}
|
|
}
|