File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,11 @@ impl BowlingGame {
96
96
}
97
97
let next_frame = self . frames . get ( frame_index+1 ) ;
98
98
if next_frame. unwrap ( ) . is_strike ( ) {
99
- let next_next_frame = self . frames . get ( frame_index+1 ) ;
100
- return ( Some ( next_frame. unwrap ( ) . roll1 ) , Some ( next_next_frame. unwrap ( ) . roll1 ) )
99
+ let next_next_frame = self . frames . get ( frame_index+2 ) ;
100
+ if next_next_frame. is_some ( ) {
101
+ return ( Some ( next_frame. unwrap ( ) . roll1 ) , Some ( next_next_frame. unwrap ( ) . roll1 ) )
102
+ }
103
+ return ( Some ( next_frame. unwrap ( ) . roll1 ) , Some ( 0 ) )
101
104
}
102
105
return ( Some ( next_frame. unwrap ( ) . roll1 ) , Some ( next_frame. unwrap ( ) . roll2 ) )
103
106
}
Original file line number Diff line number Diff line change @@ -169,7 +169,6 @@ fn points_scored_in_the_two_rolls_after_a_strike_are_counted_twice_as_a_bonus()
169
169
}
170
170
171
171
#[ test]
172
- #[ ignore]
173
172
fn consecutive_strikes_each_get_the_two_roll_bonus ( ) {
174
173
let mut game = BowlingGame :: new ( ) ;
175
174
@@ -247,6 +246,7 @@ fn a_strike_with_the_one_roll_bonus_after_a_spare_in_the_last_frame_does_not_get
247
246
}
248
247
249
248
#[ test]
249
+ #[ ignore]
250
250
fn all_strikes_is_a_perfect_score_of_300 ( ) {
251
251
let mut game = BowlingGame :: new ( ) ;
252
252
You can’t perform that action at this time.
0 commit comments