Projects the final innings score from current game state using the parameterized resource-based formula. Input matches scoreboard display.
Usage
calculate_projected_score(
current_score,
wickets,
overs,
format = "t20",
expected_initial_score = NULL,
params = NULL,
gender = "male",
team_type = "international",
min_resource_used = NULL,
apply_bounds = TRUE,
max_balls = NULL
)Arguments
- current_score
Integer. Runs scored so far in the innings.
- wickets
Integer. Wickets fallen (0-10). Matches scoreboard: "120/3" means wickets=3.
- overs
Numeric. Overs bowled in cricket notation (e.g., 13.4 = 13 overs + 4 balls). Matches scoreboard: "(13.4 overs)" means overs=13.4.
- format
Character. Format: "t20", "odi", or "test".
- expected_initial_score
Numeric. Expected innings total at start (EIS). If NULL, uses agnostic expected score for the format.
- params
Named list. Optimized parameters (a, b, z, y). If NULL, loads default parameters.
- gender
Character. "male" or "female" (used for defaults).
- team_type
Character. "international" or "club" (used for defaults).
- min_resource_used
Numeric. Minimum resource_used to prevent division issues.
- apply_bounds
Logical. Whether to apply min/max bounds on projection.
- max_balls
Integer. Override max balls for format (used by Test match innings projection).
Details
Formula: projected = cs + a * eis * resource_remaining + b * cs * resource_remaining / resource_used
Examples
# Scoreboard shows: "India 120/3 (13.4 overs)" in T20
calculate_projected_score(120, 3, 13.4, "t20")
#> ℹ Created data directory: /home/runner/work/bouncer/bouncerdata
#> [1] 154.3706
# With named parameters
calculate_projected_score(
current_score = 80,
wickets = 3,
overs = 10.0,
format = "t20"
)
#> [1] 129.5259
# With custom EIS (e.g., from full model)
calculate_projected_score(80, 3, 10.0, "t20", expected_initial_score = 175)
#> [1] 137.4898
