File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -30,24 +30,22 @@ impl Frame {
30
30
}
31
31
32
32
fn bonus_valid ( & self ) -> bool {
33
- if self . bonus_done ( ) {
34
- if self . is_spare ( ) {
35
- self . bonus_score ( ) <= 10
36
- } else if self . is_strike ( ) {
37
- if let Some ( first) = self . bonus . iter ( ) . rev ( ) . last ( ) {
38
- if * first == 10 {
39
- self . bonus_score ( ) <= 20
40
- } else {
41
- self . bonus_score ( ) <= 10
42
- }
43
- } else {
44
- true
45
- }
33
+ if self . is_open ( ) || !self . bonus_done ( ) {
34
+ return true ;
35
+ }
36
+
37
+ if self . is_spare ( ) {
38
+ return self . bonus_score ( ) <= 10 ;
39
+ }
40
+
41
+ if let Some ( first) = self . bonus . iter ( ) . next ( ) {
42
+ if * first == 10 {
43
+ self . bonus_score ( ) <= 20
46
44
} else {
47
- true
45
+ self . bonus_score ( ) <= 10
48
46
}
49
47
} else {
50
- true
48
+ unreachable ! ( ) ;
51
49
}
52
50
}
53
51
You can’t perform that action at this time.
0 commit comments