zodac / advent-of-code

Advent of Code solutions written in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advent Of Code: Java Edition

Overview

This project includes solutions to the Advent of Code programming challenges. The solutions are written in Java.

Purpose

This is not an attempt to 'code golf' solutions; Java is already a verbose language, so it's not the right tool for that sort of challenge.

Instead, I aim to create a project with re-usable algorithms and function, that can be re-used as needed rather than having to import large dependencies like Apache Commons or Google Guava.

I'm also not aiming for extreme performance. Readability and re-usability are the main goals here, so sometimes I'll use a solution with Collections and generics rather than a more performant array-based solution. As long as they complete in a reasonable time, I'll use the more readable and generic option.

How To View Solutions

The solutions for a given year are saved in their respective module. The solution for each day is run as a unit test, where a puzzle input is read and passed into the actual solution class. Sometimes some minor mapping of the input to a POJO will be done in the test set-up. The result from the solution is then asserted in the unit test.

The test module will include assertions for the example from the Advent of Code challenge, and part 1 and 2 using your own input files.

Input Files

As requested by the creator of Advent of Code, no individual input files are included in this repository. My specific inputs are included as a git submodule in the advent-of-code-inputs directory. Feel free to provide your own inputs in that directory. Each year's inputs should be placed in a module matching the module name in the source code. For example, for 2015, Day 01, its input should be available at: advent-of-code/advent-of-code-inputs/2015/day01.txt.

I use the create.sh script to generate a template for my solution files, and it also retrieves the input for the problem and commits it to the git submodule. This requires an environment variable AOC_COOKIE to be set, with your own Advent of Code cookie.

License

The source code is released under the BSD Zero Clause License.

Progress And Ranks

2023 Results
Day Part 1 Part 2
Day 1 4,216 ⭐ 6,251 ⭐
Day 2 697 ⭐ 555 ⭐
Day 3 7,815 ⭐ 5,683 ⭐
Day 4 1,382 ⭐ 4,192 ⭐
Day 5 5,526 ⭐ 13,381 ⭐
Day 6 20,700 ⭐ 19,631 ⭐
Day 7 62,595 ⭐ 57,325 ⭐
Day 8 58,501 ⭐ 46,949 ⭐
Day 9 3,777 ⭐ 3,923 ⭐
Day 10 15,633 ⭐ 9,375 ⭐
Day 11 12,279 ⭐ 14,530 ⭐
Day 12 3,335 ⭐ 5,223 ⭐
Day 13 4,432 ⭐ 7,987 ⭐
Day 14 2,890 ⭐ 5,790 ⭐
Day 15 3,486 ⭐ 3,046 ⭐
Day 16 2,697 ⭐ 2,557 ⭐
2022 Results
Day Part 1 Part 2
Day 1 181,122 ⭐ 174,520 ⭐
Day 2 146,753 ⭐ 140,513 ⭐
Day 3 112,894 ⭐ 107,699 ⭐
Day 4 87,474 ⭐ 85,471 ⭐
Day 5 9,071 ⭐ 8,050 ⭐
Day 6 2,913 ⭐ 3,596 ⭐
Day 7 9,084 ⭐ 7,992 ⭐
Day 8 4,751 ⭐ 3,356 ⭐
Day 9 7,495 ⭐ 5,231 ⭐
Day 10 7,670 ⭐ 5,514 ⭐
Day 11 2,664 ⭐ 2,420 ⭐
Day 12 7,311 ⭐ 6,766 ⭐
Day 13 14,960 ⭐ 14,025 ⭐
Day 14 30,919 ⭐ 30,485 ⭐
2021 Results
Day Part 1 Part 2
Day 1 34,535 ⭐ 30,143 ⭐
Day 2 43,645 ⭐ 41,117 ⭐
Day 3 86,014 ⭐ 67,217 ⭐
Day 4 17,500 ⭐ 15,575 ⭐
Day 5 45,830 ⭐ 43,865 ⭐
Day 6 52,188 ⭐ 46,698 ⭐
Day 7 10,242 ⭐ 17,459 ⭐
Day 8 27,980 ⭐ 15,957 ⭐
Day 9
Day 10 42,885 ⭐ 41,392 ⭐
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21 18,674 ⭐
Day 22
Day 23
Day 24
Day 25
2020 Results
Day Part 1 Part 2
Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
2019 Results
Day Part 1 Part 2
Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
2018 Results
Day Part 1 Part 2
Day 1 27,792 ⭐ 22,808 ⭐
Day 2 66,502 ⭐ 59,417 ⭐
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
2017 Results
Day Part 1 Part 2
Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
2016 Results
Day Part 1 Part 2
Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
2015 Results
Day Part 1 Part 2
Day 1 16,209 ⭐ 65,488 ⭐
Day 2 51,249 ⭐ 46,112 ⭐
Day 3 41,971 ⭐ 38,509 ⭐
Day 4 34,991 ⭐ 33,645 ⭐
Day 5 34,146 ⭐ 28,979 ⭐
Day 6 27,303 ⭐ 26,097 ⭐
Day 7 19,007 ⭐ 18,331 ⭐
Day 8 18,022 ⭐ 17,020 ⭐
Day 9 15,559 ⭐ 15,246 ⭐
Day 10 16,779 ⭐ 16,163 ⭐
Day 11 14,370 ⭐ 14,182 ⭐
Day 12 14,601 ⭐ 12,618 ⭐
Day 13 12,312 ⭐ 12,150 ⭐
Day 14 13,165 ⭐ 12,305 ⭐
Day 15 10,850 ⭐ 10,699 ⭐
Day 16 11,389 ⭐ 10,976 ⭐
Day 17 10,461 ⭐ 10,282 ⭐
Day 18 9,975 ⭐ 9,840 ⭐
Day 19 9,462 ⭐ 7,173 ⭐
Day 20 8,617 ⭐ 8,089 ⭐
Day 21 7,838 ⭐ 7,667 ⭐
Day 22 6,084 ⭐ 5,923 ⭐
Day 23 7,328 ⭐ 7,290 ⭐
Day 24 6,323 ⭐ 6,240 ⭐
Day 25 7,497 ⭐ 5,393 ⭐

About

Advent of Code solutions written in Java

License:BSD Zero Clause License


Languages

Language:Java 99.3%Language:Shell 0.7%