- Notifications
You must be signed in to change notification settings - Fork0
ebowman/adventofcode.com
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repo holds my solutions toAdvent of Code, an annual global coding competition everyDecember 1-25. I occasionally compete and occasionally back-fill old solutions.
This repo is in Scala, now updated toScala 3. Why Scala? Well,Scala is the last programming language I programmed professionally in, and I love it. It hitsa sweet spot with powerful libraries and expressiveness. Of course,not everyone loves scala, but that ok.
You'll need a working Scala development environment, which means you need theScala SDK andsbt. Gettingthat running is an exercise for the reader. Maybebrew install scala andbrew install sbt are what you need.
Once that's probably working, you can clone this repo,cd into it, and runsbt. Doing so will bring up the sbt shell;If you typetest and hit enter, it will compile all the code and run the tests.
Over time, I evolved a pattern for each day of each challenge: the hard work is generally doneinsrc/main/scala/y[year]/Day[day].scala and the code that exercises the solution and confirms that the correctanswer remains correct is a parallelScalaTest testsuite,src/test/scala/y[year]/Day[day]Spec.scala.
To take part in the challenge, either during a contest or during the rest of the year, you create an account. The Advent of Codewebsite generates custom input data for you and asks you to compute the solution based on that data. Thus, eachuser has a custom (or near-custom) output for their program that depends on their input data. Usually, there is a smallertest data set and a bigger "real" one. By convention, I put the test data insrc/main/resources/y[year]/day[day].test.txtand the real data set insrc/main/resource/y[year]/day[day].txt.
If you log in tohttps://adventofcode.com, capture the session cookie, and put the value in a file.session within theproject (notice I've put.session in.gitignore), there is a little feature that makes it quicker to compete. If you type:
sbt "run 2017 08"
for example, it will create the necessary boilerplate to quickly start working on Day 8 for the year 2017, including downloadingthe test data and put it in the file.
About
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.