File tree 11 files changed +26
-23
lines changed
11 files changed +26
-23
lines changed Original file line number Diff line number Diff line change 5
5
! ** /src /test /** /build /
6
6
7
7
# ## Advent of Code Input ###
8
- src /main /resources
9
8
src /main /resources /cookie
9
+ src /main /resources /day * .txt
10
10
11
11
# ## IntelliJ IDEA ###
12
12
.idea
Original file line number Diff line number Diff line change 2
2
3
3
My attempt in Kotlin to complete the [ 2024 Advent of Code] ( https://adventofcode.com/2024 ) .
4
4
5
- ** Current status:** Day 5 complete.
5
+ To retrieve input data, you must obtain your session cookie from
6
+ the Advent of Code website and add it to the [ resources] ( src/main/resources ) directory.
6
7
7
- ** Last updated:** 2024-12-05.
8
+ ** Current status:** Day 8 complete.
9
+
10
+ ** Last updated:** 2024-12-08.
Original file line number Diff line number Diff line change 3
3
4
4
package day01
5
5
6
- import common.day
6
+ import common.aocreader.fetchAdventOfCodeInput
7
7
import common.parsing.parseColumns
8
- import common.readInput
9
8
import common.collectionops.toFrequencyMap
10
9
import kotlin.math.abs
11
10
@@ -25,7 +24,7 @@ fun answer2(input: String): Int =
25
24
}
26
25
27
26
fun main () {
28
- val input = readInput({}:: class .day() )
27
+ val input = fetchAdventOfCodeInput( 2024 , 1 )
29
28
30
29
println (" --- Day 1: Historian Hysteria ---" )
31
30
Original file line number Diff line number Diff line change 3
3
4
4
package day02
5
5
6
+ import common.aocreader.fetchAdventOfCodeInput
6
7
import common.collectionops.allListDrops
7
- import common.day
8
8
import common.parsing.parseGrid
9
- import common.readInput
10
9
11
10
private const val Lower = 1
12
11
private const val Upper = 3
@@ -30,7 +29,7 @@ fun answer2(input: String): Int =
30
29
parseGrid(input, String ::toInt).count(::isReportAlmostSafe)
31
30
32
31
fun main () {
33
- val input = readInput({}:: class .day() )
32
+ val input = fetchAdventOfCodeInput( 2024 , 2 )
34
33
35
34
println (" --- Day 2: Red-Nosed Reports ---" )
36
35
Original file line number Diff line number Diff line change 3
3
4
4
package day03
5
5
6
- import common.day
7
- import common.readInput
6
+ import common.aocreader.fetchAdventOfCodeInput
8
7
9
8
/* *
10
9
* We want to turn off processing for substrings of the form:
@@ -31,7 +30,7 @@ fun answer2(input: String): Int =
31
30
answer1(preprocess(input))
32
31
33
32
fun main () {
34
- val input = readInput({}:: class .day() )
33
+ val input = fetchAdventOfCodeInput( 2024 , 3 )
35
34
36
35
println (" --- Day 3: Mull It Over ---" )
37
36
Original file line number Diff line number Diff line change 3
3
4
4
package day04
5
5
6
+ import common.aocreader.fetchAdventOfCodeInput
6
7
import common.countSubstrings
7
- import common.day
8
8
import common.collectionops.*
9
- import common.readInput
10
9
11
10
private const val XMAS = " XMAS"
12
11
@@ -60,7 +59,7 @@ fun answer2(input: String): Int =
60
59
countXXmases(input.lines())
61
60
62
61
fun main () {
63
- val input = readInput({}:: class .day() )
62
+ val input = fetchAdventOfCodeInput( 2024 , 4 )
64
63
65
64
println (" --- Day 4: Ceres Search ---" )
66
65
Original file line number Diff line number Diff line change 3
3
4
4
package day05
5
5
6
- import common.day
6
+ import common.aocreader.fetchAdventOfCodeInput
7
7
import common.collectionops.middle
8
- import common.readInput
9
8
10
9
private typealias OrderingRules = Map <Int , Set <Int >>
11
10
private typealias Updates = List <Int >
@@ -96,7 +95,7 @@ fun answer2(input: String): Int =
96
95
}
97
96
98
97
fun main () {
99
- val input = readInput({}:: class .day()).trim( )
98
+ val input = fetchAdventOfCodeInput( 2024 , 5 )
100
99
101
100
println (" --- Day 5: Print Queue ---" )
102
101
Original file line number Diff line number Diff line change 6
6
7
7
package day06
8
8
9
+ import common.aocreader.fetchAdventOfCodeInput
9
10
import common.intpos2d.*
10
- import common.day
11
- import common.readInput
12
11
13
12
/* *
14
13
* The direction that the guard is facing and moves in.
@@ -101,7 +100,7 @@ fun answer2(input: String): Int =
101
100
}
102
101
103
102
fun main () {
104
- val input = readInput({}:: class .day()).trim( )
103
+ val input = fetchAdventOfCodeInput( 2024 , 6 )
105
104
106
105
println (" --- Day 6: Guard Gallivant ---" )
107
106
Original file line number Diff line number Diff line change 3
3
4
4
package day07
5
5
6
+ import common.aocreader.fetchAdventOfCodeInput
6
7
import common.day
7
8
import common.parsing.WhitespaceParser
8
9
import common.readInput
@@ -58,7 +59,7 @@ fun answer2(input: String): BigInteger =
58
59
59
60
60
61
fun main () {
61
- val input = readInput({}:: class .day()).trim( )
62
+ val input = fetchAdventOfCodeInput( 2024 , 7 )
62
63
63
64
println (" --- Day 7: Bridge Repair ---" )
64
65
Original file line number Diff line number Diff line change 3
3
4
4
package day08
5
5
6
+ import common.aocreader.fetchAdventOfCodeInput
6
7
import common.day
7
8
import common.intpos2d.*
8
9
import common.readInput
@@ -83,7 +84,7 @@ fun answer2(input: String): Int =
83
84
84
85
85
86
fun main () {
86
- val input = readInput({}:: class .day()).trim( )
87
+ val input = fetchAdventOfCodeInput( 2024 , 8 )
87
88
88
89
println (" --- Day 8: Resonant Collinearity ---" )
89
90
Original file line number Diff line number Diff line change
1
+ # Resources
2
+
3
+ This directory should contain a single file named ` cookie ` (not included in GitHub)
4
+ that contains, on a single line, the cookie associated with your Advent of Code account.
You can’t perform that action at this time.
0 commit comments