summaryrefslogtreecommitdiff
path: root/2023/Go/main.go
blob: 3357d3e35dea9f18826f7271b520692875fd6460 (plain)
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
package main

import (
	"flag"
	"os"

	"github.com/DJOLEARY/Advent_of_Code/internal/day_01"
	day_02_part_01 "github.com/DJOLEARY/Advent_of_Code/internal/day_02/part_01"
	day_02_part_02 "github.com/DJOLEARY/Advent_of_Code/internal/day_02/part_02"
	day_03_part_01 "github.com/DJOLEARY/Advent_of_Code/internal/day_03/part_01"
	day_04_part_01 "github.com/DJOLEARY/Advent_of_Code/internal/day_04/part_01"
	day_04_part_02 "github.com/DJOLEARY/Advent_of_Code/internal/day_04/part_02"
	day_06_part_01 "github.com/DJOLEARY/Advent_of_Code/internal/day_06/part_01"
	day_06_part_02 "github.com/DJOLEARY/Advent_of_Code/internal/day_06/part_02"
	day_07_part_01 "github.com/DJOLEARY/Advent_of_Code/internal/day_07/part_01"
)

func main() {
	day := flag.Int("day", 1, "Day to run")
	part := flag.Int("part", 2, "Part to run, must be 1 or 2")

	flag.Parse()

	if *part < 1 || *part > 2 {
		println("Invalid part number, must be 1 or 2")
		os.Exit(1)
	}

	switch *day {
	case 1:
		switch *part {
		case 1:
			println("Day 1 part 1 not implemented")
			os.Exit(1)
		case 2:
			day_01.Solve()
		}

	case 2:
		switch *part {
		case 1:
			day_02_part_01.Solve()
		case 2:
			day_02_part_02.Solve()
		}

	case 3:
		switch *part {
		case 1:
			day_03_part_01.Solve()
		case 2:
			println("Day 3 part 2 not implemented")
			os.Exit(1)
		}

	case 4:
		switch *part {
		case 1:
			day_04_part_01.Solve()
		case 2:
			day_04_part_02.Solve()
		}

	case 6:
		switch *part {
		case 1:
			day_06_part_01.Solve()
		case 2:
			day_06_part_02.Solve()
		}

	case 7:
		switch *part {
		case 1:
			day_07_part_01.Solve()
		case 2:
			println("Day 7 part 2 not implemented")
			os.Exit(1)
		}

	default:
		println("Day not implemented")
		os.Exit(1)
	}
}