|
|
|
|
@ -1882,12 +1882,16 @@ public enum RoundRule { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static func numberOfMatches(forRoundIndex roundIndex: Int) -> Int { |
|
|
|
|
Int(pow(2.0, Double(roundIndex))) |
|
|
|
|
(1 << roundIndex) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static func baseIndex(forRoundIndex roundIndex: Int) -> Int { |
|
|
|
|
numberOfMatches(forRoundIndex: roundIndex) - 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static func matchIndexWithinRound(fromMatchIndex matchIndex: Int) -> Int { |
|
|
|
|
let roundIndex = roundIndex(fromMatchIndex: matchIndex) |
|
|
|
|
let matchIndexWithinRound = matchIndex - (Int(pow(2.0, Double(roundIndex))) - 1) |
|
|
|
|
let matchIndexWithinRound = matchIndex - baseIndex(forRoundIndex: roundIndex) |
|
|
|
|
return matchIndexWithinRound |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1911,7 +1915,7 @@ public enum RoundRule { |
|
|
|
|
} |
|
|
|
|
return "Quart de finale" |
|
|
|
|
default: |
|
|
|
|
return "\(Int(pow(2.0, Double(roundIndex))))ème" |
|
|
|
|
return "\((1 << roundIndex))ème" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|