Skip to content

Commit

Permalink
minor tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondben committed Nov 24, 2023
1 parent 52ac5d8 commit 8d704e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Remotes: openvolley/datavolley
5 changes: 2 additions & 3 deletions R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,13 @@ do_sim_set_mc <- function(rates, process_model, serving, go_to, simple, id, poin
rates0 <- rates ## these might be functions
while (all(sc < go_to) || abs(diff(sc)) < point_margin) {
tm_scores[ptr + 1, ] <- tm_scores[ptr, ] ## scores at the START of the next point, updated below
rots[ptr + 1, ] <- rots[ptr, ] ## scores at the START of the next point, updated below
rots[ptr + 1, ] <- rots[ptr, ] ## rotations at the START of the next point, updated below
rates <- rates0
idx <- seq_len(ptr)
if (is.function(rates[[1]])) {
idx <- seq_len(ptr)
rates[[1]] <- rates[[1]](team_1_score = tm_scores[idx, 1], team_2_score = tm_scores[idx, 2], team_1_rotation = rots[idx, 1], team_2_rotation = rots[idx, 2], serving = tm_srv[idx], point_won_by = tm_point_won_by[idx], outcome = outcome[idx], go_to = go_to)
}
if (is.function(rates[[2]])) {
idx <- seq_len(ptr)
rates[[2]] <- rates[[2]](team_1_score = tm_scores[idx, 1], team_2_score = tm_scores[idx, 2], team_1_rotation = rots[idx, 1], team_2_rotation = rots[idx, 2], serving = tm_srv[idx], point_won_by = tm_point_won_by[idx], outcome = outcome[idx], go_to = go_to)
}
srv_tm_rates <- rates[[srv]] ## serving team's rates
Expand Down

0 comments on commit 8d704e8

Please sign in to comment.