2024-12-01 09:55:43 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"advent_of_code_2024/day_01"
|
2024-12-03 18:35:51 +00:00
|
|
|
"advent_of_code_2024/day_02"
|
2024-12-03 19:05:59 +00:00
|
|
|
"advent_of_code_2024/day_03"
|
2024-12-04 17:26:41 +00:00
|
|
|
"advent_of_code_2024/day_04"
|
2024-12-05 18:34:53 +00:00
|
|
|
"advent_of_code_2024/day_05"
|
2024-12-06 21:41:21 +00:00
|
|
|
"advent_of_code_2024/day_06"
|
2024-12-08 13:21:14 +00:00
|
|
|
"advent_of_code_2024/day_07"
|
2024-12-08 16:56:36 +00:00
|
|
|
"advent_of_code_2024/day_08"
|
2024-12-09 22:53:46 +00:00
|
|
|
"advent_of_code_2024/day_09"
|
2024-12-10 09:13:42 +00:00
|
|
|
"advent_of_code_2024/day_10"
|
2024-12-11 09:04:55 +00:00
|
|
|
"advent_of_code_2024/day_11"
|
2024-12-12 08:16:52 +00:00
|
|
|
"advent_of_code_2024/day_12"
|
2024-12-01 09:55:43 +00:00
|
|
|
_ "embed"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
selectedDay := selectSolutionRun()
|
|
|
|
|
|
|
|
switch selectedDay {
|
|
|
|
case "01-basic":
|
|
|
|
fmt.Printf("Day 01. Basic: %d\n", day_01.SolveBasic(Day01Data)) // 2113135
|
|
|
|
case "01-complex":
|
|
|
|
fmt.Printf("Day 01. Complex: %d\n", day_01.SolveComplex(Day01Data)) // 19097157
|
2024-12-03 18:35:51 +00:00
|
|
|
case "02-basic":
|
|
|
|
fmt.Printf("Day 02. Basic: %d\n", day_02.SolveBasic(Day02Data)) // 690
|
|
|
|
case "02-complex":
|
|
|
|
fmt.Printf("Day 02. Complex: %d\n", day_02.SolveComplex(Day02Data)) // 710
|
2024-12-03 19:05:59 +00:00
|
|
|
case "03-basic":
|
|
|
|
fmt.Printf("Day 03. Basic: %d\n", day_03.SolveBasic(Day03Data)) // 189527826
|
|
|
|
case "03-complex":
|
|
|
|
fmt.Printf("Day 03. Complex: %d\n", day_03.SolveComplex(Day03Data)) // 63013756
|
2024-12-04 17:26:41 +00:00
|
|
|
case "04-basic":
|
|
|
|
fmt.Printf("Day 04. Basic: %d\n", day_04.SolveBasic(Day04Data)) // 2560
|
|
|
|
case "04-complex":
|
2024-12-05 18:34:53 +00:00
|
|
|
fmt.Printf("Day 04. Complex: %d\n", day_04.SolveComplex(Day04Data)) // 1980
|
|
|
|
case "05-basic":
|
|
|
|
fmt.Printf("Day 05. Basic: %d\n", day_05.SolveBasic(Day05Data)) // 2560
|
|
|
|
case "05-complex":
|
|
|
|
fmt.Printf("Day 05. Complex: %d\n", day_05.SolveComplex(Day05Data)) // 63013756
|
2024-12-06 21:41:21 +00:00
|
|
|
case "06-basic":
|
|
|
|
fmt.Printf("Day 06. Basic: %d\n", day_06.SolveBasic(Day06Data)) //
|
|
|
|
case "06-complex":
|
|
|
|
fmt.Printf("Day 06. Complex: %d\n", day_06.SolveComplex(Day06Data)) //
|
2024-12-08 13:21:14 +00:00
|
|
|
case "07-basic":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 07. Basic: %d\n", day_07.SolveBasic(Day07Data)) //
|
2024-12-08 13:21:14 +00:00
|
|
|
case "07-complex":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 07. Complex: %d\n", day_07.SolveComplex(Day07Data)) //
|
2024-12-08 16:56:36 +00:00
|
|
|
case "08-basic":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 08. Basic: %d\n", day_08.SolveBasic(Day08Data)) //
|
2024-12-08 16:56:36 +00:00
|
|
|
case "08-complex":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 08. Complex: %d\n", day_08.SolveComplex(Day08Data)) //
|
2024-12-09 22:53:46 +00:00
|
|
|
case "09-basic":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 09. Basic: %d\n", day_09.SolveBasic(Day09Data)) //
|
2024-12-09 22:53:46 +00:00
|
|
|
case "09-complex":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 09. Complex: %d\n", day_09.SolveComplex(Day09Data)) //
|
2024-12-10 09:13:42 +00:00
|
|
|
case "10-basic":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 10. Basic: %d\n", day_10.SolveBasic(Day10Data)) //
|
2024-12-10 09:13:42 +00:00
|
|
|
case "10-complex":
|
2024-12-10 09:22:05 +00:00
|
|
|
fmt.Printf("Day 10. Complex: %d\n", day_10.SolveComplex(Day10Data)) //
|
2024-12-11 09:04:55 +00:00
|
|
|
case "11-basic":
|
|
|
|
fmt.Printf("Day 11. Basic: %d\n", day_11.SolveBasic(Day11Data)) //
|
|
|
|
case "11-complex":
|
|
|
|
fmt.Printf("Day 11. Complex: %d\n", day_11.SolveComplex(Day11Data)) //
|
2024-12-12 08:16:52 +00:00
|
|
|
case "12-basic":
|
|
|
|
fmt.Printf("Day 12. Basic: %d\n", day_12.SolveBasic(Day12Data)) //
|
|
|
|
case "12-complex":
|
|
|
|
fmt.Printf("Day 12. Complex: %d\n", day_12.SolveComplex(Day12Data)) //
|
2024-12-01 09:55:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func selectSolutionRun() string {
|
|
|
|
selectedDay := ""
|
|
|
|
if len(os.Args) == 2 {
|
|
|
|
// if command line arg passed use that
|
|
|
|
selectedDay = os.Args[1]
|
|
|
|
} else if len(os.Args) == 1 {
|
|
|
|
// otherwise ask user for the solution
|
|
|
|
fmt.Printf("Enter the solution to be run: e.g. 01-basic,21-complex...\n")
|
|
|
|
if _, err := fmt.Scan(&selectedDay); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// if too many arguments are passed return error message
|
|
|
|
fmt.Printf("Invalid number of arguments\nUsage: %s day-basic|day-complex\n e.g. %s 01-basic", os.Args[0], os.Args[0])
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
return selectedDay
|
|
|
|
}
|