diff --git a/day-13/internal/util/util.go b/day-13/internal/util/util.go index 3057b24..f27261c 100644 --- a/day-13/internal/util/util.go +++ b/day-13/internal/util/util.go @@ -19,16 +19,16 @@ func ParseLines(r io.Reader) ([]*machine.Machine, error) { scanner := bufio.NewScanner(r) for scanner.Scan() { - lineBytes := scanner.Bytes() - if len(lineBytes) == 0 { + line := scanner.Text() + if len(line) == 0 { continue } var m []string - switch line := string(lineBytes); { - case reButton.Match(lineBytes): + switch line := line; { + case reButton.MatchString(line): m = reButton.FindStringSubmatch(line) - case rePrize.Match(lineBytes): + case rePrize.MatchString(line): m = rePrize.FindStringSubmatch(line) } @@ -47,7 +47,7 @@ func ParseLines(r io.Reader) ([]*machine.Machine, error) { return machines, nil } -func mustConv(s string) int { +func MustConv(s string) int { n, err := strconv.Atoi(s) if err != nil { panic(err)