My solutions for Advent of Code 2022 wrapped in a resilient CLI and built using Maven and Java 17.
- Clone this repository to your local machine
- Install any missing dependencies:
- Create a new run configuration in IntelliJ IDEA:
- Set
JDK 17as the JRE - Set
Mainas the main class
- Set
- Run the project π
Utils.java contains some commonly used helper methods:
List<String> readFile(int day)returns aListcontaining the input for the provided day. Usage:List<String> day12Input = readFile(12);
String convertDayIntToString(int day)returns a two-digitStringrepresentation of the provided day. Usage:convertDayIntToString(02) == "02"; // true convertDayIntToString(12) == "12"; // true
void printSolutionMessage(int day, int part, String solution)prints a solution message to standard output. Usage:printSolutionMessage(12, 1, "42"); // Solution (Day 12.1): 42
getValueOfCharacter(char character)returns anintvalue for a given character. Usage:getValueOfCharacter('a') == 1; getValueOfCharacter('B') == 28;
reverseString(String input)returns a reversedStringof the given input. Usage:reverseString("Hello World!") == "!dlroW olleH"; // true
The models directory contains classes that may come in handy:
FileNodecan be used to build a tree representing a file system. EachFileNodehas:List<FileNode> childrenFileNode parent(nullif it is the root)File data
Filecan be used to represent a file in a file system. EachFilehas:String nameint size(0if it is a directory)
Monkeycan be used to represent a monkey playing keep away. EachMonkeyhas:int idQueue<Long> itemslong itemsSeenMap<String, Integer> operationint throwConditionOperandint trueThrowIdint falseThrowId