Created
November 4, 2010 17:49
-
-
Save abyx/662854 to your computer and use it in GitHub Desktop.
Bowling snippet clean code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if isStrike(frameIndex): | |
score += FULL_FRAME_SCORE + strikeFrameBonus(frameIndex) | |
frameIndex++ | |
elif isSpare(frameIndex): | |
score += FULL_FRAME_SCORE + spareFrameBonus(frameIndex) | |
frameIndex += 2 | |
else: | |
score += frameScore(frameIndex) | |
frameIndex += 2 | |
def strikeFrameScore(i): return rolls[i + 1] + rolls[i + 2] | |
def spareFrameScore(i): return rolls[i + 2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment