AI prompts
base on The Advent of Code template project for Kotlin # Advent of Code Kotlin Template
[Advent of Code][aoc] – an annual event in December since 2015.
Every year since then, with the first day of December, a programming puzzles contest is published every day for twenty-five days.
A set of Christmas-oriented challenges provides any input you have to use to answer using the language of your choice.
We offer you a template prepared to use with [Kotlin][kotlin] language within this repository.
![][file:cover]
## Live Streams
Join us as we solve the Advent of Code challenges live on stream!
Follow along to see step-by-step solutions, participate in problem-solving, and learn new strategies to tackle the puzzles.
Whether you're stuck on a particular problem or just looking to improve your Kotlin skills, our live streams are here to help.
[Watch the live streams here!][youtube-playlist]
[![][file:livestream]][youtube-playlist]
## Workflow
**Advent of Code Kotlin Template** is a particular type of GitHub repository that lets you speed up the setup phase and start writing your AoC solutions immediately.
The general idea is straightforward – to create a new project based on this template, you need to log in to your GitHub account and use the **Use this template** green button.
And remember – **do not fork it!**
After creating a new project based on this template in your account, a dedicated GitHub Actions workflow will start and clean up the code from redundant files.
It will also personalize code to use your username and project name in namespaces and Gradle properties.
How cool is that?
You can clone it within the IntelliJ IDEA whenever the [@actions-user][actions-user] actor pushes the second commit to your repository.
> [!IMPORTANT]
>
> Right after opening the project in IntelliJ IDEA, verify if you use at least **Java 11** as Project SDK.
> 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).
From now on, everything's in your hands!
Join the [Advent of Code][aoc] contest to solve the *Day 01* as soon as it is published.
Copy the `Day01.kt` solution file for the following days and increment the day number.
> [!NOTE]
>
> Remember to join the Kotlin contest!
>
> To do that, edit your project's _About_ section with ⚙️ icon and add the `aoc-2024-in-kotlin` topic to your project.
>
> **We will find your repository and count you in our giveaway.**
## Setup
After you create a new project based on the current template repository using the **Use this template** button, a bare minimal scaffold will appear in your GitHub account with the following structure:
```
.
├── README.md README file
├── build.gradle.kts Gradle configuration created with Kotlin DSL
├── settings.gradle.kts Gradle project settings
├── gradle* Gradle wrapper files
└── src
├── Day01.kt An empty implementation for the first AoC day
├── Utils.kt A set of utility methods shared across your days
│
│ (create those files manually)
├── Day01.txt An empty file for the Day 01 input data
└── Day01_test.txt An optional Day 01 test input data used for checks
```
> [!NOTE]
>
> 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).
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.
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.
To read the input data, you can go with the `readInput(name: String)` utility method provided in the [`Utils.kt`][file:utils] file, like:
```kotlin
fun main() {
fun part1(input: List<String>): Int {
return input.size
}
val input = readInput("Day01")
println(part1(input))
}
```
## Running
To call the algorithm you're implementing, click the green Play button next to the `fun main()` definition.
![img.png](.github/readme/run.png)
> [!IMPORTANT]
>
> Create relevant files Before running tasks or tests, like: `src/Day01.txt` or `src/Day01_test.txt`.
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].
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.
To handle that case, you can put such an input into a separate file and perform a check against the output, like:
```kotlin
fun main() {
// ...
val testInput = readInput("Day01_test")
check(part1(testInput) == 13)
}
```
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.
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`.
The final result of your algorithm will be printed on the screen so that you can pass it to the Advent of Code website.
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:
```kotlin
fun main() {
fun part1(input: List<String>): Int {
return 0
}
fun part2(input: List<String>): Int {
return 0
}
val input = readInput("Day02")
println(part1(input))
println(part2(input))
}
```
> [!NOTE]
>
> There is a fork of this repository available that utilizes the Amper tool for project configuration, recently [introduced by JetBrains][amper].
>
> For more, see [Advent of Code Kotlin Template — Amper][amper-template] project.
## Getting help
If you are stuck with Kotlin-specific questions or anything related to this template, check out the following resources:
- [Kotlin docs][docs]
- [Kotlin Slack][slack]
- Template [issue tracker][issues]
[actions-user]: https://github.com/actions-user
[aoc]: https://adventofcode.com
[amper]: https://blog.jetbrains.com/blog/2023/11/09/amper-improving-the-build-tooling-user-experience/
[amper-template]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template-amper
[docs]: https://kotlinlang.org/docs/home.html
[docs-project-structure]: https://www.jetbrains.com/help/idea/project-settings-and-structure.html
[issues]: https://github.com/kotlin-hands-on/advent-of-code-kotlin-template/issues
[kiss]: https://en.wikipedia.org/wiki/KISS_principle
[kotlin]: https://kotlinlang.org
[slack]: https://surveys.jetbrains.com/s3/kotlin-slack-sign-up
[file:cover]: .github/readme/cover.png
[file:livestream]: .github/readme/livestream.png
[file:utils]: src/Utils.kt
[youtube-playlist]: https://www.youtube.com/playlist?list=PLlFc5cFwUnmwHaD3-qeoLHnho_PY2g9JX
", Assign "at most 3 tags" to the expected json: {"id":"5501","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"