class BowlingScorer::Frame
- BowlingScorer::Frame
- Reference
- Object
Overview
Frame holds our rolls for a single frame. This can allow us to set rolls as we parse the game. We can also check the frame forwards and backwards during parsing by checking what rolls have been set. This allows us to know where we are in the current frame during the parsing process.
Defined in:
bowling-scorer/frame.crConstructors
Instance Method Summary
-
#completed? : Bool
completed? helps us know if the frame has been completed.
- #frame : Int32
- #roll_one : Token
- #roll_one=(roll_one : Token)
- #roll_one? : Token | Nil
- #roll_three : Token
- #roll_three=(roll_three : Token)
- #roll_three? : Token | Nil
- #roll_two : Token
- #roll_two=(roll_two : Token)
- #roll_two? : Token | Nil
- #score : Int32
- #score=(score : Int32)
- #score? : Int32 | Nil
-
#set_roll(token : Token) : Void
set_roll helps us set the next roll in the frame.
Constructor Detail
Instance Method Detail
completed? helps us know if the frame has been completed. The parser uses this to know when to make a new frame. Special case for frame 10 with three rolls. If not frame 10 a frame is complete if its either a strike or roll one and roll two are present.
set_roll helps us set the next roll in the frame. Special case for frame 10 with three rolls. Checks which roll starting with one is empty.