y2015d6p1 forgot to negate NOT value on return
This commit is contained in:
parent
742f35b73e
commit
25be019d72
@ -9,7 +9,7 @@ pub fn process_part1(input: &str) -> HashMap<String, u16> {
|
|||||||
instructions.insert(wire.to_string(), expression.to_string());
|
instructions.insert(wire.to_string(), expression.to_string());
|
||||||
}
|
}
|
||||||
for wire in instructions.keys() {
|
for wire in instructions.keys() {
|
||||||
set_wire(wire.to_owned(), &mut wires, &instructions);
|
set_wire(wire.to_string(), &mut wires, &instructions);
|
||||||
}
|
}
|
||||||
wires
|
wires
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ fn set_wire(
|
|||||||
if parts.len() == 2 {
|
if parts.len() == 2 {
|
||||||
let value = set_wire(parts[1].clone(), wires, instructions);
|
let value = set_wire(parts[1].clone(), wires, instructions);
|
||||||
wires.insert(wire, !value);
|
wires.insert(wire, !value);
|
||||||
return value;
|
return !value;
|
||||||
}
|
}
|
||||||
if parts.len() == 3 {
|
if parts.len() == 3 {
|
||||||
let left = match parts[0].parse::<u16>() {
|
let left = match parts[0].parse::<u16>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user