File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,33 @@ tasks {
1313 gradleVersion = " 8.5"
1414 }
1515}
16+
17+ task(" generateNextDay" ) {
18+ doLast {
19+ val prevDayNum = fileTree(" $projectDir /src" ).matching {
20+ include(" Day*.kt" )
21+ }.maxOf {
22+ val (prevDayNum) = Regex (" Day(\\ d\\ d)" ).find(it.name)!! .destructured
23+ prevDayNum.toInt()
24+ }
25+ val newDayNum = String .format(" %02d" , prevDayNum + 1 )
26+ File (" $projectDir /src" , " Day$newDayNum .kt" ).writeText(
27+ """
28+ fun main() {
29+ fun part1(input: List<String>): Int {
30+ return 0
31+ }
32+ fun part2(input: List<String>): Int {
33+ return 0
34+ }
35+ // test if implementation meets criteria from the description, like:
36+ val testInput = readInput("resources/Day${newDayNum} _test")
37+ check(part1(testInput) == 0)
38+ val input = readInput("resources/Day$newDayNum ")
39+ println(part1(input))
40+ println(part2(input))
41+ }
42+ """
43+ )
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments