diff --git a/src/day12/day12.go b/src/day12/day12.go index ef19016..aa44097 100644 --- a/src/day12/day12.go +++ b/src/day12/day12.go @@ -21,17 +21,10 @@ type stepTracking struct { func main() { args := os.Args[1:] input, err := helper.GetInput(args[0]) - input2, err := helper.GetInput("day12TestPart2Routes.txt") if err != nil { fmt.Println(err) } - testRoutesPart2 := make([][]string, 0) - for _, line := range input2 { - splitLine := strings.Split(line, ",") - testRoutesPart2 = append(testRoutesPart2, splitLine) - } - routeMap := make(map[string][]string) for _, line := range input { splitLine := strings.Split(line, "-") @@ -46,29 +39,18 @@ func main() { //part1 allRoutesCounter := 0 - getRoute(&routeMap, []string{"start"}, &allRoutesCounter, 1, &testRoutesPart2) + getRoute(&routeMap, []string{"start"}, &allRoutesCounter, 1) fmt.Println(allRoutesCounter) //part2 allRoutesCounter = 0 - getRoute(&routeMap, []string{"start"}, &allRoutesCounter, 2, &testRoutesPart2) + getRoute(&routeMap, []string{"start"}, &allRoutesCounter, 2) fmt.Println(allRoutesCounter) - fmt.Println(len(testRoutesPart2)) - fmt.Println() - for _, route := range testRoutesPart2 { - fmt.Println(route) - } - } -func getRoute(routeMap *map[string][]string, drivenRoute []string, allRoutesCounter *int, part int, testRoutesPart2 *[][]string) { +func getRoute(routeMap *map[string][]string, drivenRoute []string, allRoutesCounter *int, part int) { if drivenRoute[len(drivenRoute)-1] == "end" { *allRoutesCounter++ - for i, route := range *testRoutesPart2 { - if helper.EqualStringArray(route, drivenRoute) { - *testRoutesPart2 = append((*testRoutesPart2)[:i], (*testRoutesPart2)[i+1:]...) - } - } return } @@ -84,7 +66,7 @@ func getRoute(routeMap *map[string][]string, drivenRoute []string, allRoutesCoun for _, step := range possibleNextSteps { newDrivenRoute := append(drivenRoute, step) - getRoute(routeMap, newDrivenRoute, allRoutesCounter, part, testRoutesPart2) + getRoute(routeMap, newDrivenRoute, allRoutesCounter, part) } } diff --git a/src/day8/day8.exe b/src/day8/day8.exe new file mode 100644 index 0000000..779818f Binary files /dev/null and b/src/day8/day8.exe differ diff --git a/src/day9/day9.exe b/src/day9/day9.exe new file mode 100644 index 0000000..a8ecd87 Binary files /dev/null and b/src/day9/day9.exe differ