knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

aocr

Lifecycle: experimental

aocr is fast and convenient way to download your Advent of Code puzzle input. Inspired by libraries like aocd and adventdrob.

Installation

You can install the development version of aocr from GitHub with:

# install.packages("devtools")
devtools::install_github("botan/aocr")

Usage

Puzzle inputs vary by user. You must set your AOC_SESSION in .Renvrion file. Here's a step by step guide to get your session cookie:

  1. Log in to Advent of Code on your preferred web browser.

  2. Right-click on the webpage and click "Inspect" to open the developer console.

  3. Go the Network tab and reload to page.

  4. Click the "adventofcode.com" request.

  5. Go the Cookie tab under the Request Headers.

  6. You will find your Cookie as session=<copy here>.

  7. Copy that session ID and save inside your .Renviron as AOC_SESSION=<paste here>. If you have any trouble with finding your .Renviron file, you can use usethis::edit_r_environ().

  8. Restart R session.

This is a basic example which shows you how to get your input:

library(aocr)
library(fs)

dir_ls()

Sys.Date()

input()

input(2021, 1)

dir_ls()

input <- scan("input01.txt")
head(input)


botan/aocr documentation built on Jan. 5, 2022, 4:10 p.m.