This commit is contained in:
Erin 2023-12-02 16:57:10 +01:00
parent 2cf807f941
commit 76a1f9c330

View file

@ -23,10 +23,9 @@ fn part1(id: u64, game: &str) -> Result<u64> {
.map(|poll| -> Result<bool> { .map(|poll| -> Result<bool> {
let (count, colour) = n_colour_pair(poll)?; let (count, colour) = n_colour_pair(poll)?;
Ok(match colour { Ok(match colour {
"red" if count <= 12 => true, "red" => count <= 12,
"green" if count <= 13 => true, "green" => count <= 13,
"blue" if count <= 14 => true, "blue" => count <= 14,
"red" | "green" | "blue" => false,
c => { c => {
bail!("Invalid colour: {c}, expected red, green or blue") bail!("Invalid colour: {c}, expected red, green or blue")
} }