在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):kotlin-hands-on/advent-of-code-kotlin-template开源软件地址(OpenSource Url):https://github.com/kotlin-hands-on/advent-of-code-kotlin-template开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):Advent of Code Kotlin TemplateAdvent of Code – 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-four days. A set of Christmas-oriented challenges provide any input you have to use to answer using the language of your choice. We offer you a template prepared to use with Kotlin language within this repository. WorkflowAdvent 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? Right after the @actions-user actor pushes the second commit to your repository, you're ready to clone it within the IntelliJ IDEA. From now, everything's in your hands! Join the Advent of Code contest, solve the Day O1 as soon as it is published. For the following days, copy the
ContentAfter 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:
When the first puzzle appears, go to the To read the input data, you can go with the fun main() {
fun part1(input: List<String>): Int {
return input.size
}
val input = readInput("Day01")
println(part1(input))
} The 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 separated file and perform a check against the output, like: fun main() {
// ...
val testInput = readInput("Day01_test")
check(part1(testInput) == 13)
} The current approach of providing both 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 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))
} Getting helpIf you stuck with Kotlin-specific questions or anything related to this template, check out the following resources:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论