AdventOfCode.jl Documentation



AdventOfCode.jl exports one function, setup_files that lets you get up and running with Advent of Code problems by downloading data and setting up your file structure. To get started, you need an AdventOfCode cookie. Navigate to, log in with whichever method you prefer and grab your cookie, using one of these methods depending on your browser.

Once you have your cookie, store it in ENV["AOC_SESSION"]. After that, you should be ready to use this package. Since the Advent of Code cookies are very long-lived, I suggest adding ENV["AOC_SESSION"] = {YOUR_COOKIE} to your ~/.julia/config/startup.jl file so that it's always available when you start Julia.


setup_files(year, day; force = false, include_year = true)
setup_files(; force = false, include_year = true)

Downloads the input file for the specified year and date and stores that file in {year}/data/day_{day}.txt or data/day_{day}.txt if include_year is set to false. Also sets up a template file in {year}/src/day_{day}.jl for your script (src/day_{day}.jl if include_year is set to false). force=true will recreate the src file even if it already exists. The data file will not be re-downloaded even with force=true since it's a static file and to reduce load on AdventOfCode's servers.

If year and day are not provided, the setup defaults to today's date.