You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
[Advent of Code][aoc] – an annual event in December since 2015.
4
4
Every year since then, with the first day of December, a programming puzzles contest is published every day for twenty-four days.
5
-
A set of Christmas-oriented challenges provide any input you have to use to answer using the language of your choice.
5
+
A set of Christmas-oriented challenges provides any input you have to use to answer using the language of your choice.
6
6
We offer you a template prepared to use with [Kotlin][kotlin] language within this repository.
7
7
8
8
![][file:cover]
@@ -24,25 +24,25 @@ After creating a new project based on this template in your account, a dedicated
24
24
It will also personalize code to use your username and project name in namespaces and Gradle properties.
25
25
How cool is that?
26
26
27
-
Right after the [@actions-user][actions-user] actor pushes the second commit to your repository, you're ready to clone it within the IntelliJ IDEA.
27
+
You can clone it within the IntelliJ IDEA whenever the [@actions-user][actions-user] actor pushes the second commit to your repository.
28
28
29
29
> [!IMPORTANT]
30
30
>
31
31
> Right after opening the project in IntelliJ IDEA, verify if you use at least **Java 17** as Project SDK.
32
32
> To do that, visit [Project Structure Settings][docs-project-structure] (<kbd>⌘ Cmd</kbd><kbd>;</kbd> on macOS or <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>Shift</kbd><kbd>S</kbd> on Windows/Linux).
33
33
34
-
From now, everything's in your hands!
35
-
Join the [Advent of Code][aoc] contest, solve the *Day 01* as soon as it is published.
34
+
From now on, everything's in your hands!
35
+
Join the [Advent of Code][aoc] contest to solve the *Day 01* as soon as it is published.
36
36
37
-
For the following days, copy the `Day01.kt` solution file and increment the day number.
37
+
Copy the `Day01.kt` solution file for the following days and increment the day number.
38
38
39
39
> [!NOTE]
40
40
>
41
41
> Remember to join the Kotlin contest!
42
-
>
42
+
>
43
43
> To do that, edit your project's _About_ section with ⚙️ icon and add the `aoc-2023-in-kotlin` topic to your project.
44
-
>
45
-
> **We will find your repository and count you in our giveaway.**
44
+
>
45
+
> **We will find your repository and count you in our giveaway.**
46
46
47
47
## Setup
48
48
@@ -53,12 +53,12 @@ After you create a new project based on the current template repository using th
53
53
├── README.md README file
54
54
├── module.yaml Amper configuration file
55
55
├── settings.gradle.kts Gradle project settings
56
-
├── gradle* Gradle wraper files
56
+
├── gradle* Gradle wrapper files
57
57
└── src
58
58
├── Day01.kt An empty implementation for the first AoC day
59
59
├── Utils.kt A set of utility methods shared across your days
60
60
│
61
-
│ (files needed to be manually created)
61
+
│ (create those files manually)
62
62
├── Day01.txt An empty file for the Day 01 input data
63
63
└── Day01_test.txt An optional Day 01 test input data used for checks
64
64
```
@@ -67,8 +67,8 @@ After you create a new project based on the current template repository using th
67
67
>
68
68
> All task input files (`src/*.txt`) are excluded from the repository with `.gitignore` – we should not post them publicly, as [Eric Wastl requested for](https://twitter.com/ericwastl/status/1465805354214830081).
69
69
70
-
When the first puzzle appears, go to the `Day01.kt` and for each `part1` and `part2`functions, provide an algorithm implementation using the `input` data loaded from the `src/Day01.txt` file.
71
-
This input data is common for both parts, and you can find it on the bottom of each day on the [Advent of Code][aoc] page.
70
+
When the first puzzle appears, go to the `Day01.kt`, and for each `part1` and `part2`function, provide an algorithm implementation using the `input` data loaded from the `src/Day01.txt` file.
71
+
This input data is common for both parts, and you can find it at the bottom of each day on the [Advent of Code][aoc] page.
72
72
73
73
To read the input data, you can go with the `readInput(name: String)` utility method provided in the [`Utils.kt`][file:utils] file, like:
74
74
@@ -85,18 +85,18 @@ fun main() {
85
85
86
86
## Running
87
87
88
-
To call the algorithm you're implementing, click on the green Play button next to the `fun main()` definition.
88
+
To call the algorithm you're implementing, click the green Play button next to the `fun main()` definition.
89
89
90
90

91
91
92
92
> [!IMPORTANT]
93
93
>
94
-
> Before running tasks or tests, make sure to create relevant files, like: `src/Day01.txt` or `src/Day01_test.txt`.
94
+
> Create relevant files Before running tasks or tests, like: `src/Day01.txt` or `src/Day01_test.txt`.
95
95
96
96
The [`Utils.kt`][file:utils] file also contains the `String.md5()` method for generating MD5 hash out of the given string and expects more helper functions for the sake of the [KISS principle][kiss].
97
97
98
98
Each puzzle describes some test conditions, a small portion of the information that helps check if the produced value for the given test input is valid.
99
-
To handle that case, you can put such an input into a separated file and perform a check against the output, like:
99
+
To handle that case, you can put such an input into a separate file and perform a check against the output, like:
100
100
101
101
```kotlin
102
102
funmain() {
@@ -108,11 +108,11 @@ fun main() {
108
108
```
109
109
110
110
The current approach of providing both `part1` and `part2` solutions within the single `Day##.kt` file may sometimes bring a disadvantage due to the first solution calculation when we expect to work on the second part only.
111
-
With simple cases that don't consume too much of your time and resources that can be almost unnoticeable, but when solution takes seconds, it is worth considering breaking daily solution into two separated pieces, like `Day07_part1.kt` and `Day07_part2.kt`.
111
+
With simple cases that don't consume too much of your time and resources that can be almost unnoticeable, but when the solution takes seconds, it is worth considering breaking the daily solution into two separated pieces, like `Day07_part1.kt` and `Day07_part2.kt`.
112
112
113
113
The final result of your algorithm will be printed on the screen so that you can pass it to the Advent of Code website.
114
114
115
-
To go with the next day, place the `Day02.txt` file into the `src` with relevant input data and create `Day02.kt` file with a similar code scaffold:
115
+
To go with the next day, place the `Day02.txt` file into the `src` with relevant input data and create a `Day02.kt` file with a similar code scaffold:
116
116
117
117
```kotlin
118
118
funmain() {
@@ -132,7 +132,7 @@ fun main() {
132
132
133
133
## Getting help
134
134
135
-
If you stuck with Kotlin-specific questions or anything related to this template, check out the following resources:
135
+
If you are stuck with Kotlin-specific questions or anything related to this template, check out the following resources:
0 commit comments