package main import ( "advent_of_code_2024/day_01" "advent_of_code_2024/day_02" "advent_of_code_2024/day_03" "advent_of_code_2024/day_04" "advent_of_code_2024/day_05" "advent_of_code_2024/day_06" "advent_of_code_2024/day_07" "advent_of_code_2024/day_08" "advent_of_code_2024/day_09" "advent_of_code_2024/day_10" "advent_of_code_2024/day_11" "advent_of_code_2024/day_12" _ "embed" "fmt" "os" "time" ) func main() { selectedDay := selectSolutionRun() start := time.Now() 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 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 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 case "04-basic": fmt.Printf("Day 04. Basic: %d\n", day_04.SolveBasic(Day04Data)) // 2560 case "04-complex": 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 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)) // case "07-basic": fmt.Printf("Day 07. Basic: %d\n", day_07.SolveBasic(Day07Data)) // case "07-complex": fmt.Printf("Day 07. Complex: %d\n", day_07.SolveComplex(Day07Data)) // case "08-basic": fmt.Printf("Day 08. Basic: %d\n", day_08.SolveBasic(Day08Data)) // case "08-complex": fmt.Printf("Day 08. Complex: %d\n", day_08.SolveComplex(Day08Data)) // case "09-basic": fmt.Printf("Day 09. Basic: %d\n", day_09.SolveBasic(Day09Data)) // case "09-complex": fmt.Printf("Day 09. Complex: %d\n", day_09.SolveComplex(Day09Data)) // case "10-basic": fmt.Printf("Day 10. Basic: %d\n", day_10.SolveBasic(Day10Data)) // case "10-complex": fmt.Printf("Day 10. Complex: %d\n", day_10.SolveComplex(Day10Data)) // 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)) // 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)) // case "12-complex-fast": fmt.Printf("Day 12. Complex (fast): %d\n", day_12.SolveComplexFast(Day12Data)) // } elapsed := time.Since(start) fmt.Printf("Solution took: %s", elapsed) } 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 }