-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.go
51 lines (40 loc) · 791 Bytes
/
common.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
package main
import (
"bufio"
"log"
"os"
"time"
)
func main() {
day6()
}
func timeTrack(start time.Time, name string) {
elapsed := time.Since(start)
log.Printf("%s took %s", name, elapsed)
}
func dayX() {
println("Solving AoC 2024 Day X:")
input := loadInputDayX()
dayXpart1(input)
dayXpart2(input)
}
func loadInputDayX() []string {
defer timeTrack(time.Now(), "Loading/Parsing Input")
file, err := os.Open("inputs/dayX.txt")
if err != nil {
panic(err)
}
scanner := bufio.NewScanner(file)
lines := make([]string, 0)
for scanner.Scan() {
var line = scanner.Text()
lines = append(lines, line)
}
return lines
}
func dayXpart1(lines []string) {
defer timeTrack(time.Now(), "Part1")
}
func dayXpart2(lines []string) {
defer timeTrack(time.Now(), "Part2")
}