parent
d6d81a0c29
commit
d88f907c03
@ -1,6 +1,6 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use aoc_runner_derive::{aoc, aoc_generator};
|
use aoc_runner_derive::aoc;
|
||||||
use grid::{Coord2d, Grid};
|
use grid::{Coord2d, Grid};
|
||||||
|
|
||||||
pub struct Farm {
|
pub struct Farm {
|
||||||
|
@ -20,9 +20,9 @@ impl ClawMachine {
|
|||||||
let prize_re = Regex::new(r"X=(\d+), Y=(\d+)").unwrap();
|
let prize_re = Regex::new(r"X=(\d+), Y=(\d+)").unwrap();
|
||||||
// consume 3 lines - a, b, prize
|
// consume 3 lines - a, b, prize
|
||||||
if let Some((a_line, b_line, prize_line)) = input.filter(|l| !l.is_empty()).take(3).collect_tuple() {
|
if let Some((a_line, b_line, prize_line)) = input.filter(|l| !l.is_empty()).take(3).collect_tuple() {
|
||||||
let a_caps = ofs_re.captures(&a_line).unwrap();
|
let a_caps = ofs_re.captures(a_line).unwrap();
|
||||||
let b_caps = ofs_re.captures(&b_line).unwrap();
|
let b_caps = ofs_re.captures(b_line).unwrap();
|
||||||
let prize_caps = prize_re.captures(&prize_line).unwrap();
|
let prize_caps = prize_re.captures(prize_line).unwrap();
|
||||||
let button_a = MachineAction(
|
let button_a = MachineAction(
|
||||||
a_caps.get(1).unwrap().as_str().parse().unwrap(),
|
a_caps.get(1).unwrap().as_str().parse().unwrap(),
|
||||||
a_caps.get(2).unwrap().as_str().parse().unwrap(),
|
a_caps.get(2).unwrap().as_str().parse().unwrap(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user