Get the puzzle input from the Advent of Code website for a given day and year
and save it to a file. The file will be saved in the current working
directory with a relative path "./YYYY/day/DD/input"
, where YYYY
is the
value of the year parameter and DD
is value of the day parameter. This path
echoes the URL structure of the Advent of Code website.
Details
This function assumes that you have an account on the Advent of Code website. For this function to work, you must set
the ADVENT_SESSION
environment variable in your .Renviron
file. For
guidance on how to find your session token, see
https://github.com/dgrtwo/adventdrob/tree/main#installation. Once you have
your session token, you can set the environment variable with
usethis::edit_r_environ()
. This function is adapted from
https://github.com/dgrtwo/adventdrob/blob/main/R/input.R, but saves the
input to a file instead of returning it as a data frame. Once the input is
saved, it can be read in with aoc_input_vector()
, aoc_input_data_frame()
or
aoc_input_matrix()
, whichever is appropriate for the puzzle.
This function is also called as part of aoc_new_day()
.
See also
aoc_new_day()
aoc_input_vector()
aoc_input_data_frame()
[aoc_input_matrix()