tracks/swift/exercises/bowling/BowlingExample.swift in trackler-2.0.0.3 vs tracks/swift/exercises/bowling/BowlingExample.swift in trackler-2.0.0.4
- old
+ new
@@ -76,11 +76,11 @@
private func validFrame(pins: Int) -> Bool {
if isLastFrame {
let lastRollWasStrike = scoreCard[currentFrame]?.last == 10
- if lastRollWasStrike {
+ if lastRollWasStrike || isSpare() {
return true
}
}
let lastRoll = scoreCard[currentFrame]?.last ?? 0
@@ -92,10 +92,10 @@
return isLastFrame && frameComplete()
}
private func frameComplete() -> Bool {
if isLastFrame {
- return frameFilled(rolls: 3) || isOpenFrame() && frameFilled()
+ return isOpenFrame() && frameFilled() || frameFilled(rolls: 3)
}
return frameFilled() || isStrike()
}