Skip to content

Instantly share code, notes, and snippets.

@joelnitta
Created January 24, 2024 08:59
Show Gist options
  • Save joelnitta/6f836cb2073d49c1ceae5d9a5d94d134 to your computer and use it in GitHub Desktop.
Save joelnitta/6f836cb2073d49c1ceae5d9a5d94d134 to your computer and use it in GitHub Desktop.
Look for double-casted spells on T1
library(tidyverse)
library(magicr)
library(arrow)
# Download WOE replay data
woe_game_replay_file <- mr_download_17lands_file(
"WOE", "replay", "premier")
# Load WOE replay data
woe_game_replay <- arrow::open_csv_dataset(
woe_game_replay_file,
col_types = schema(
draft_id = string(),
user_turn_1_creatures_cast = string(),
user_turn_1_non_creatures_cast = string(),
user_turn_1_user_instants_sorceries_cast = string(),
game_number = int32()
))
# Look for double casted spells on T1
woe_game_replay_sel <-
woe_game_replay %>%
select(
draft_id,
game_number,
user_turn_1_creatures_cast,
user_turn_1_non_creatures_cast,
user_turn_1_user_instants_sorceries_cast,
) %>%
collect()
double_spell_t1 <-
woe_game_replay_sel %>%
unite(
col = "user_turn_1_cast",
contains("user_turn_1"),
na.rm = TRUE, sep = "|",
remove = FALSE) %>%
filter(str_detect(user_turn_1_cast, fixed("|")))
double_spell_t1 %>%
select(-user_turn_1_cast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment