day3 and 4

This commit is contained in:
2023-12-04 13:31:13 +00:00
parent e7cd9346f2
commit 56571eadf0
10 changed files with 664 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ import (
"adventofcode2023/utils"
"adventofcode2023/day01"
"adventofcode2023/day02"
"adventofcode2023/day03"
"adventofcode2023/day04"
)
// Usage: go run main.go <NN>
// assumes input is in day<NN>/input.txt
@@ -23,6 +25,12 @@ func main() {
case 2:
fmt.Printf("part 1: %d\n", day02.Part1(utils.Readfile(d)))
fmt.Printf("part 2: %d\n", day02.Part2(utils.Readfile(d)))
case 3:
fmt.Printf("part 1: %d\n", day03.Part1(utils.Readfile(d)))
fmt.Printf("part 2: %d\n", day03.Part2(utils.Readfile(d)))
case 4:
fmt.Printf("part 1: %d\n", day04.Part1(utils.Readfile(d)))
fmt.Printf("part 2: %d\n", day04.Part2(utils.Readfile(d)))
default:
panic(fmt.Errorf("no such day: %d", d))
}
@@ -30,7 +38,7 @@ func main() {
// Reads day from os.Args.
func day() int {
latest := 1
latest := 3
if len(os.Args) == 1 {
return latest
}
@@ -83,5 +91,6 @@ func TestPart2(t *testing.T) {
}
`, n))
fmt.Printf("wrote day%02d/day%02d_test.go\n", n, n)
utils.GenInputFile(n)
}