-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
96 lines (90 loc) · 2.01 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package main
import (
"aoc2024/day00"
"aoc2024/day01"
"aoc2024/day02"
"aoc2024/day03"
"aoc2024/day04"
"aoc2024/day05"
"aoc2024/day06"
"aoc2024/day07"
"aoc2024/day08"
"aoc2024/day09"
"aoc2024/day10"
"aoc2024/day11"
"aoc2024/day12"
"aoc2024/day13"
"aoc2024/day14"
"aoc2024/day15"
"aoc2024/utils"
"fmt"
"os"
"time"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: go run main.go <day>")
return
}
var part1Solver, part2Solver func(input string) int
day := os.Args[1]
var input string
switch day {
case "00":
part1Solver = day00.SolvePart1
part2Solver = day00.SolvePart2
case "01":
part1Solver = day01.SolvePart1
part2Solver = day01.SolvePart2
case "02":
part1Solver = day02.SolvePart1
part2Solver = day02.SolvePart2
case "03":
part1Solver = day03.SolvePart1
part2Solver = day03.SolvePart2
case "04":
part1Solver = day04.SolvePart1
part2Solver = day04.SolvePart2
case "05":
part1Solver = day05.SolvePart1
part2Solver = day05.SolvePart2
case "06":
part1Solver = day06.SolvePart1
part2Solver = day06.SolvePart2
case "07":
part1Solver = day07.SolvePart1
part2Solver = day07.SolvePart2
case "08":
part1Solver = day08.SolvePart1
part2Solver = day08.SolvePart2
case "09":
part1Solver = day09.SolvePart1
part2Solver = day09.SolvePart2
case "10":
part1Solver = day10.SolvePart1
part2Solver = day10.SolvePart2
case "11":
part1Solver = day11.SolvePart1
part2Solver = day11.SolvePart2
case "12":
part1Solver = day12.SolvePart1
part2Solver = day12.SolvePart2
case "13":
part1Solver = day13.SolvePart1
part2Solver = day13.SolvePart2
case "14":
part1Solver = day14.SolvePart1
part2Solver = day14.SolvePart2
case "15":
part1Solver = day15.SolvePart1
part2Solver = day15.SolvePart2
default:
fmt.Printf("Day %s not solved yet!\n", day)
return
}
input = utils.ReadInput("day" + day + "/input.txt")
start := time.Now()
fmt.Println("Part 1:", part1Solver(input))
fmt.Println("Part 2:", part2Solver(input))
fmt.Println("Took", time.Since(start))
}