diff --git a/day-2/one.go b/day-2/one.go index d2db6c4..0364bc2 100644 --- a/day-2/one.go +++ b/day-2/one.go @@ -21,7 +21,6 @@ var limits = map[string]int{ // isValidGame calculates if a game was possible based on the limits of each cube colour func isValidGame(data string) (bool, error) { - valid := true for _, colour := range []string{"red", "green", "blue"} { m := regex[colour].FindAllStringSubmatch(data, -1) for _, s := range m { @@ -30,12 +29,12 @@ func isValidGame(data string) (bool, error) { return false, err } if n > limits[colour] { - valid = false + return false, nil } } } - return valid, nil + return true, nil } // one returns the sum of ids for all games that were possible