rcg_covert.R 554 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#' Read RCG file
#' 
#' @param path RCG file path
#' @return Parsed tibble of RCG file in \code{path}
#' @examples 
#' read_rcg("data/20220405162804-HELIOS_base_3-vs-enemy_2.rcg")

get_ball <- function(rcg) {
  ball <- rcg |>
    dplyr::select(
      step, 
      ball_x, 
      ball_y, 
      ball_vx, 
      ball_vy
    ) |>
    dplyr::distinct(step, .keep_all = T)
  return(ball)
}

get_agent_pos <- function(rcg) {
  agent_pos <- rcg |>
    dplyr::select(
      step,
      side,
      unum,
      type,
      x,
      y,
    )
  return(agent_pos)
}