diff --git a/src/day_six.ts b/src/day_six.ts index 482f96e..ead7a0a 100644 --- a/src/day_six.ts +++ b/src/day_six.ts @@ -8,12 +8,12 @@ export type Race = [number, number]; const timeName = string('Time:').pipe(then(spaces1())); const distanceName = string('Distance:').pipe(then(spaces1())); -const timeParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify(), between(timeName, whitespace())); -const distanceParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify(), between(distanceName, whitespace())); +const numbersParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify()); +const timeParser = numbersParser.pipe(between(timeName, whitespace())); +const distanceParser = numbersParser.pipe(between(distanceName, whitespace())); const parser = timeParser.pipe(then(distanceParser)); - export class BoatRace { private readonly race: Race;