Commits

Christoph Schindler  committed 6fbef24

pair 2

  • Participants
  • Parent commits 98d7cfd
  • Branches dojo-2012-10-21

Comments (0)

Files changed (2)

File BowlingWithAVengeance/bowling.py

         return True
     return False
 
+def is_spare(frame):
+    return frame_score(frame) == 10 and not is_strike(frame)
+    
 def get_score(frames):
     score = 0
     
                 if is_strike(next_frame):
                     next_next_frame = frames[index+2]
                     score += next_next_frame[0]
+            elif is_spare(frame):
+                score += 2
     return score

File BowlingWithAVengeance/test.py

     assert_equal(bowling.get_score(((10,), (10,), (5,4))), 25+19+9)
     
 def test_get_score_5():
-    assert_equal(bowling.get_score(((10,), (10,), (2,4))), 22+16+6)
+    assert_equal(bowling.get_score(((10,), (10,), (2,4))), 22+16+6)
+    
+def test_get_score_three_strikes():
+    assert_equal(bowling.get_score(((10,), (10,), (10,), (2,4))), 30+22+16+6)
+    
+def test_spare():
+    assert_equal(bowling.get_score(((1, 9), (2, 4))), 18)