class BowlingScorer::Frame

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.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(frame : Int32 = frame) #

[View source]

Instance Method Detail

def completed? : Bool #

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.


[View source]
def frame : Int32 #

[View source]
def roll_one : Token #

def roll_one=(roll_one : Token) #

[View source]
def roll_one? : Token | Nil #

def roll_three : Token #

def roll_three=(roll_three : Token) #

[View source]
def roll_three? : Token | Nil #

def roll_two : Token #

def roll_two=(roll_two : Token) #

[View source]
def roll_two? : Token | Nil #

def score : Int32 #

def score=(score : Int32) #

[View source]
def score? : Int32 | Nil #

def set_roll(token : Token) : Void #

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.


[View source]