Skip to content

Instantly share code, notes, and snippets.

@abyx
Created November 4, 2010 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abyx/662854 to your computer and use it in GitHub Desktop.
Save abyx/662854 to your computer and use it in GitHub Desktop.
Bowling snippet clean code
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