Apple's packages and HM are included; import
accordingly as needed.
Each day is a library. When you start working on a new day…
- Create folders and files for the new day, in
Sources
andTests
, if someone else hasn't already. - Update "(year, days)" tuple at the top of the manifest to match.
There is also an AOC
folder/library. Code that is useful for multiple puzzles (probably input parsing stuff) should go there.
Push any changes that are not specific to your own solutions, to main
, so that others can use them.
Copy your daily "puzzle input" directly from Advent of Code.
Paste it into a file named Input.md
in the same folder as your test file.
Just copy the smaller sample data that exists on each puzzles page into a multiline String literal, making sure to add an empty line at the end to replicate the format of Input
files.
Push changes to your own branch.
You'll want at least these imports in each test file, filling in the ?
s as appropriate.
import AOC
import AOC_20??_?
import XCTest
The test files should mostly provide parsed input data to code in the Sources
folder, and check answers.
For puzzle solutions…
- Write a failing test with a random answer and get the right answer from the failure message instead.
- Copy that to the Advent of Code website and get a 🌟!
- Also, copy it into the test, so that it can pass in the future.