Skip to content

Commit 9a0e226

Browse files
committed
Consistent wording
1 parent 3192ebe commit 9a0e226

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

aoc2024/src/bin/24.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn part_two(input: &str) -> Option<String> {
137137

138138
let mut bad_outputs = HashSet::new();
139139
// check FAGate0 gates for Zns
140-
// each of these should be An XOR Bn -> VAL0n
140+
// each of these should be Xn XOR Yn -> VAL0n
141141
// except for the first one, which should be x00 XOR y00 -> z00
142142
let fa0s = rules
143143
.iter()
@@ -157,8 +157,7 @@ pub fn part_two(input: &str) -> Option<String> {
157157
}
158158
});
159159

160-
// call rules that do not take Xn & Yn gates as inputs indirect
161-
// check all XOR gates that are indirect (FAGate3)
160+
// check all XOR gates that do not take Xn or Yn inputs (FAGate3)
162161
// each of these should be outputting to a zXX
163162
let fa3s = rules
164163
.iter()
@@ -206,10 +205,6 @@ pub fn part_two(input: &str) -> Option<String> {
206205
if r.out() == "z00" {
207206
return false;
208207
}
209-
if bad_outputs.contains(r.out()) {
210-
// skip - already a bad output
211-
return false;
212-
}
213208
!fa3s
214209
.iter()
215210
.any(|r2| r2.left() == r.out() || r2.right() == r.out())
@@ -224,7 +219,7 @@ pub fn part_two(input: &str) -> Option<String> {
224219
.expect("Shoud have a next");
225220
let left = expected_fa3.left();
226221
let right = expected_fa3.right();
227-
// find an FAGate4 that outputs a c_in used as input to the expected FAGate3
222+
// find an FAGate4 that outputs a CIN used as input to the expected FAGate3
228223
// the other input should be the output of the bad FAGate0
229224
rules.iter().for_each(|r3| {
230225
if matches!(r3, Rule::Or(_)) {

0 commit comments

Comments
 (0)