-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
81 lines (73 loc) · 1.7 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
package main
import (
"fmt"
"os"
"strconv"
"github.com/askreet/aoc2023/advent"
"github.com/askreet/aoc2023/day1"
"github.com/askreet/aoc2023/day10"
"github.com/askreet/aoc2023/day11"
"github.com/askreet/aoc2023/day12"
"github.com/askreet/aoc2023/day13"
"github.com/askreet/aoc2023/day14"
"github.com/askreet/aoc2023/day15"
"github.com/askreet/aoc2023/day16"
"github.com/askreet/aoc2023/day18"
"github.com/askreet/aoc2023/day2"
"github.com/askreet/aoc2023/day20"
"github.com/askreet/aoc2023/day22"
"github.com/askreet/aoc2023/day3"
"github.com/askreet/aoc2023/day4"
"github.com/askreet/aoc2023/day5"
"github.com/askreet/aoc2023/day6"
"github.com/askreet/aoc2023/day7"
"github.com/askreet/aoc2023/day8"
"github.com/askreet/aoc2023/day9"
)
var Days = []advent.Interface{
day1.Solution{},
day2.Solution{},
day3.Solution{},
day4.Solution{},
day5.Solution{},
day6.Solution{},
day7.Solution{},
day8.Solution{},
day9.Solution{},
day10.Solution{},
day11.Solution{},
day12.Solution{},
day13.Solution{},
day14.Solution{},
day15.Solution{},
day16.Solution{},
day16.Solution{}, // TODO
day18.Solution{},
day18.Solution{}, // TODO
day20.Solution{},
day20.Solution{}, // TODO
day22.Solution{},
}
func main() {
day, err := strconv.ParseInt(os.Args[1], 10, 64)
if err != nil {
fmt.Println("err: ", err)
os.Exit(1)
}
input, err := os.Open(fmt.Sprintf("in/day%d.txt", day))
if err != nil {
fmt.Println("err: ", err)
os.Exit(1)
}
var part = ""
if len(os.Args) >= 3 {
part = os.Args[2]
}
if part == "" || part == "1" {
fmt.Println("part1: ", Days[day-1].Part1(input))
}
_, _ = input.Seek(0, 0)
if part == "" || part == "2" {
fmt.Println("part2: ", Days[day-1].Part2(input))
}
}