Skip to content

Commit 5e80363

Browse files
initial setup
Took 5 minutes
1 parent 921eefe commit 5e80363

File tree

5 files changed

+214
-1
lines changed

5 files changed

+214
-1
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
16+
### Eclipse ###
17+
.apt_generated
18+
.classpath
19+
.factorypath
20+
.project
21+
.settings
22+
.springBeans
23+
.sts4-cache
24+
25+
### NetBeans ###
26+
/nbproject/private/
27+
/nbbuild/
28+
/dist/
29+
/nbdist/
30+
/.nb-gradle/
31+
build/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
# adventofcode2024
1+
# Advent of Code 2024
2+
3+
Solutions in Java for the Advent of Code in 2024
4+
5+
## Goals
6+
7+
1. Do not spend too much development time on a solution
8+
2. Write tests with the example input to ensure that everything works and keeps working
9+
3. Improve readability when writing an algorithm
10+
4. Lower down the complexity when not impacting too much the readability
11+
5. Try some new features of the languages or libraries when possible
12+
6. Use the [Darkyen's Time Tracker](https://plugins.jetbrains.com/plugin/9286-darkyen-s-time-tracker) to inject the time spend of each puzzle`
13+

pom.xml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.adventofcode.aminetti</groupId>
8+
<artifactId>AoC2024</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>21</maven.compiler.source>
13+
<maven.compiler.target>21</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>commons-io</groupId>
20+
<artifactId>commons-io</artifactId>
21+
<version>2.18.0</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.apache.commons</groupId>
25+
<artifactId>commons-lang3</artifactId>
26+
<version>3.17.0</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.apache.commons</groupId>
30+
<artifactId>commons-text</artifactId>
31+
<version>1.12.0</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.apache.commons</groupId>
35+
<artifactId>commons-collections4</artifactId>
36+
<version>4.5.0-M2</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>com.google.guava</groupId>
40+
<artifactId>guava</artifactId>
41+
<version>33.3.1-jre</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.slf4j</groupId>
45+
<artifactId>slf4j-api</artifactId>
46+
<version>2.0.16</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.slf4j</groupId>
50+
<artifactId>slf4j-simple</artifactId>
51+
<version>2.0.16</version>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>org.junit.jupiter</groupId>
56+
<artifactId>junit-jupiter</artifactId>
57+
<version>5.11.3</version>
58+
<scope>test</scope>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>org.junit.jupiter</groupId>
63+
<artifactId>junit-jupiter-api</artifactId>
64+
<version>5.11.3</version>
65+
<scope>test</scope>
66+
</dependency>
67+
<dependency>
68+
<groupId>org.hamcrest</groupId>
69+
<artifactId>hamcrest</artifactId>
70+
<version>3.0</version>
71+
<scope>test</scope>
72+
</dependency>
73+
</dependencies>
74+
75+
<build>
76+
<plugins>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-enforcer-plugin</artifactId>
80+
<version>3.5.0</version>
81+
<executions>
82+
<execution>
83+
<goals>
84+
<goal>enforce</goal>
85+
</goals>
86+
<configuration>
87+
<rules>
88+
<dependencyConvergence/>
89+
</rules>
90+
91+
</configuration>
92+
</execution>
93+
</executions>
94+
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<version>3.5.2</version>
99+
</plugin>
100+
</plugins>
101+
</build>
102+
103+
</project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package aminetti.adventofcode2024;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
import java.util.regex.Matcher;
6+
import java.util.regex.Pattern;
7+
8+
import static java.lang.Long.parseLong;
9+
10+
public class ParsingUtils {
11+
12+
public static List<Long> readNumbers(String line) {
13+
List<Long> results = new ArrayList<>();
14+
Pattern pattern = Pattern.compile("(-?\\d+)");
15+
16+
Matcher matcher = pattern.matcher(line);
17+
18+
while (matcher.find()) {
19+
results.add(parseLong(matcher.group()));
20+
}
21+
return results;
22+
}
23+
24+
25+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SLF4J's SimpleLogger configuration file
2+
# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
3+
4+
# Default logging detail level for all instances of SimpleLogger.
5+
# Must be one of ("trace", "debug", "info", "warn", or "error").
6+
# If not specified, defaults to "info".
7+
#org.slf4j.simpleLogger.defaultLogLevel=info
8+
9+
# Logging detail level for a SimpleLogger instance named "xxxxx".
10+
# Must be one of ("trace", "debug", "info", "warn", or "error").
11+
# If not specified, the default logging detail level is used.
12+
#org.slf4j.simpleLogger.log.xxxxx=
13+
14+
# Set to true if you want the current date and time to be included in output messages.
15+
# Default is false, and will output the number of milliseconds elapsed since startup.
16+
#org.slf4j.simpleLogger.showDateTime=false
17+
18+
# The date and time format to be used in the output messages.
19+
# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
20+
# If the format is not specified or is invalid, the default format is used.
21+
# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
22+
#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
23+
24+
# Set to true if you want to output the current thread name.
25+
# Defaults to true.
26+
#org.slf4j.simpleLogger.showThreadName=true
27+
28+
# Set to true if you want the Logger instance name to be included in output messages.
29+
# Defaults to true.
30+
#org.slf4j.simpleLogger.showLogName=true
31+
32+
# Set to true if you want the last component of the name to be included in output messages.
33+
# Defaults to false.
34+
org.slf4j.simpleLogger.showShortLogName=true

0 commit comments

Comments
 (0)