Schafkopf-Server/Sources/App/Model/Trick.swift
2021-12-01 22:49:54 +01:00

17 lines
336 B
Swift

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, +)
}
}