@@ -137,7 +137,7 @@ pub fn part_two(input: &str) -> Option<String> {
137
137
138
138
let mut bad_outputs = HashSet :: new ( ) ;
139
139
// 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
141
141
// except for the first one, which should be x00 XOR y00 -> z00
142
142
let fa0s = rules
143
143
. iter ( )
@@ -157,8 +157,7 @@ pub fn part_two(input: &str) -> Option<String> {
157
157
}
158
158
} ) ;
159
159
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)
162
161
// each of these should be outputting to a zXX
163
162
let fa3s = rules
164
163
. iter ( )
@@ -206,10 +205,6 @@ pub fn part_two(input: &str) -> Option<String> {
206
205
if r. out ( ) == "z00" {
207
206
return false ;
208
207
}
209
- if bad_outputs. contains ( r. out ( ) ) {
210
- // skip - already a bad output
211
- return false ;
212
- }
213
208
!fa3s
214
209
. iter ( )
215
210
. any ( |r2| r2. left ( ) == r. out ( ) || r2. right ( ) == r. out ( ) )
@@ -224,7 +219,7 @@ pub fn part_two(input: &str) -> Option<String> {
224
219
. expect ( "Shoud have a next" ) ;
225
220
let left = expected_fa3. left ( ) ;
226
221
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
228
223
// the other input should be the output of the bad FAGate0
229
224
rules. iter ( ) . for_each ( |r3| {
230
225
if matches ! ( r3, Rule :: Or ( _) ) {
0 commit comments