Expand description
RAoC - Rust Advent of Code helper library
An oxidation of aoc_helper
.
Usage
RAoC is both a library and a binary. The binary can be used to control the configuration for the library (instead of modifying the configuration directory directly).
RAoC shares its configuration directory with aoc_helper
; so if you have one working, the other should too.
Automation
This project aims to be compliant with the Advent of Code Automation Guidelines. Here are the strategies it uses:
- Once inputs are downloaded, they are cached in
~/.config/aoc_helper/YEAR/DAY.in
(or a similar path for Windows users) -sync_fetch
,async_fetch
- The
User-Agent
header declares the package name, version, and my contact info -USER_AGENT
, used for every sync and async - If requesting input before the puzzle unlocks, the library will wait for unlock before sending any requests (except on day 1, where it will send a request to validate the session token) - sync, async
- If sending an answer too soon after an incorrect one, the library will wait the cooldown specified in the response (async) (sending only one extra request; it is however possible for a user to send multiple requests in quick succession, by repeatedly calling
submit
before the cooldown is over) - Advent of Code will not be queried at all if the puzzle has already been solved (async) or if an answer has already been submitted (async)
Configuration
(lifted straight from the documentation of aoc_helper
)
When you first use any function that interfaces with Advent of Code, you will be prompted to enter your session token.
Your session token is stored as a HTTPOnly cookie. This means there is no way of extracting it with JavaScript, you either must use a browser extension such as EditThisCookie, or follow this guide
This token is stored in
~/.config/aoc_helper/token.txt
(C:\Users\YOUR_USERNAME\.config\aoc_helper\token.txt
on Windows), and otheraoc_helper
data is stored in this folder (such as your input and submission caches).If, for whatever reason, you feel the need to clear your caches, you can do so by deleting the relevant folders in
aoc_helper
’s configuration folder.
Traits
Functions
- Fetch and return the input for
day
ofyear
. - Retrieve the example input and answer for the specified puzzle.
- Run the functions only if we haven’t seen a solution.
- Run the function only if we haven’t seen a solution.
- Submit a solution.
- Wait the specified time, displaying a countdown, a spinner, and a message.
- Run the given worker function, displaying a message, spinner, and elapsed timer.
- Fetch and return the input for
day
ofyear
. - Fetch and return the input for
day
ofyear
. - Retrieve the example input and answer for the specified puzzle.
- Retrieve the example input and answer for the specified puzzle.
- Run the functions only if we haven’t seen a solution.
- Run the functions only if we haven’t seen a solution.
- Run the function only if we haven’t seen a solution.
- Run the function only if we haven’t seen a solution.
- Submit a solution.
- Submit a solution.
- Fetch and return the input for
day
ofyear
. - Retrieve the example input and answer for the specified puzzle.
- Run the functions only if we haven’t seen a solution.
- Run the function only if we haven’t seen a solution.
- Submit a solution.
- Wait the specified time, displaying a countdown, a spinner, and a message.
- Run the given worker function, displaying a message, spinner, and elapsed timer.
- Wait the specified time, displaying a countdown, a spinner, and a message.
- Wait the specified time, displaying a countdown, a spinner, and a message.
- Run the given worker function, displaying a message, spinner, and elapsed timer.
- Run the given worker function, displaying a message, spinner, and elapsed timer.