Skip to contents

Stores base information for a single scoring rule

Details

Include method for calculating scoring.

Public fields

event

Stores the scoring event for the rule

range

Stores the range for the event that is valid for the rule

points

Stores how many points is given for the event. If first character is * then it is a multiplier rule. If the points is in the format x/y then x points is given for every y. If points is just a number then that is what is scored if the value is within the range.

Methods


Method new()

Create a new rule

Usage

scoring_rule$new(event = NULL, range = NULL, points = NULL)

Arguments

event

The scoring event to create the rule for.

range

The event range to create the scoring rule for.

points

The points setting for the scoring rule.

Details

Creates a new rule based on the event, range and points specified.


Method print()

Displays Rule Details

Usage

scoring_rule$print()


Method value()

Calculates the value resulting from the value x happening for the event.

Usage

scoring_rule$value(x, season = FALSE, season_weeks = 16)

Arguments

x

The value for the event that needs to be scored.

season

Is the value x for an entire season?

season_weeks

Number of weeks included in the season.


Method match()

Determines if supplied event and range matches with the current rule.

Usage

scoring_rule$match(event, range)

Arguments

event

Which event to look for

range

Which range to look for

Details

Can be used to find a specific rule


Method clone()

The objects of this class are cloneable with this method.

Usage

scoring_rule$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.