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> {
let (count, colour) = n_colour_pair(poll)?;
Ok(match colour {
"red" if count <= 12 => true,
"green" if count <= 13 => true,
"blue" if count <= 14 => true,
"red" | "green" | "blue" => false,
"red" => count <= 12,
"green" => count <= 13,
"blue" => count <= 14,
c => {
bail!("Invalid colour: {c}, expected red, green or blue")
}