knitr::opts_chunk$set(echo = TRUE)
pacman::p_load(tidyverse, purrr, tidyr)
players <- rbind( tibble(name = "fish", fun = list(player_random)), tibble(name = "call", fun = list(player_call)), tibble(name = "call2", fun = list(player_call)) #tibble(name = "me", fun = list(player_random)) ) %>% mutate(credit = c(100, 100, 100), bb = 2) p_game <- game$new(players, delay = 0) p_game$run(verbose = T) p_game$events %>% glimpse p_game$result
get_state_pairs <- function(.x){ .x %>% dplyr::mutate(id = 1:n()) %>% dplyr::group_by(game_id, name, stake, id) %>% tidyr::nest(.key = "s") %>% dplyr::ungroup() %>% dplyr::mutate(s_ = dplyr::lead(s, 1), t = as.numeric(purrr::map_lgl(s_, is.null))) } pairs <- p_game$events %>% split(.$name) %>% map_dfr(get_state_pairs)
pairs$s_[[10]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.