16
$\begingroup$

I was playing with some electronics recently, and I had bought three logic gates to make a small flat device that took two inputs, I1 and I2, and returned them in the opposite order (I2 then I1).

Unfortunately, I was using some acid to separate a couple of pieces of metal that were soldered together, and I hadn't put away my device, so a drop of acid fell down and melted away a section of one of the wires. Frantically I tested my device, and it just returned the inputs in the order they were entered.

I chucked the device away and bought some new materials, but the day after the rubbish was collected, I realised I forgot to make a circuit diagram. All I remembered was that the gates were 2 input, 1 output, and that they were symmetric in their inputs (so the first input being high and the second being low had the same output as the second input being high and the first low).

Can you recreate the circuit diagram for me, and tell me on which segment of wire the acid spilt?


Clarifications:

  • The device was flat, so no wire crossings occured.

  • The diagram needs to be accurate up to topology.

  • The flow went strictly in the direction from the input side to the output side, so there were no loops.

  • The wires did split at points, but two wires only joined at a gate.

  • The device looked like this:

    I1 ->-               ->- O1  
          \             /        
           [THE CIRCUIT]         
          /             \        
    I2 ->-               ->- O2
    

    where originally I1=O2 and I2=O1, but after the acid was spilt I1=O1 and I2=O2.

$\endgroup$
  • $\begingroup$ I don't see why the input would change... $\endgroup$ – TrojanByAccident Jan 25 '17 at 6:37
  • 1
    $\begingroup$ ^vote with a note: I'd like to see more puzzles like this, perhaps with a new specific tag. If it doesn't give away too much, how about adding a list of 2-input gates, or a web link? I gather there are just 8 candidates, disregarding the condition of symmetry, but would like to be sure this is what you mean. (Ooops, now that I see the solutions, a list of gates would be for the sake of posterity.) $\endgroup$ – humn Jan 25 '17 at 8:34
  • $\begingroup$ Since the intended answer apparently relies on inputs floating low and this is by no means a safe assumption it should be included in the problem statement. $\endgroup$ – Peter Taylor Jan 26 '17 at 7:09
12
$\begingroup$

Unfortunately I don't know how to draw the diagram but I will try to explain the logic behind it and where you dropped the acid you clumsy, you...

You build a

Swap circuit (you already stated that) that uses XOR (^) to swap the inputs.

And the 3 operations were: (let's say the input was X and Y to make it easier to explain. No need to involve letters and numbers also)

A = X ^ Y
B = X ^ A
C = Y ^ A
Then just output B and C.

Why did the initial circuit work?

The first operation does what is says it does, but XOR is associative and commutative.
So the second one is similar to doing B = X ^ (X ^ Y) which is the same as Y = X ^ X ^ Y.
However, X ^ X is zero. and 0 ^ Y = Y. This means that the value of B is Y.
By the same logic on operation 3 you get C having the value of X.

And you dropped acid on

The output of the first operation A = X ^ Y.

And now it just does this

A = X ^ Y
B = 0 ^ X
C = 0 ^ Y
Then just output B and C.

And this outputs the original values because

The first operation does nothing of use.
0 ^ X = X, so the second operation just gives X.
In the same way, 0 ^ Y = Y.
Then you output the values, and they are the same as the initial ones.

I hope this is enough to get you to build your circuit schema again. I'm glad I could help.

[EDIT]

Thanks to humn for providing this picture.

$\endgroup$
  • $\begingroup$ Correct - do you mind if I add a couple of diagrams and clear some things up? $\endgroup$ – boboquack Jan 25 '17 at 7:31
  • $\begingroup$ I will try but I don't promise anything. If the diagram provided by stack reader is correct just tell me. so I won't overload my brain for nothing. $\endgroup$ – Marius Jan 25 '17 at 7:48
  • $\begingroup$ I'm happy to do it for you - stack reader's diagram is correct except for where the 'oil spill' is - acid burns away, not fuses. $\endgroup$ – boboquack Jan 25 '17 at 7:50
  • $\begingroup$ If I don't post anything in the next 10 minutes I would probably need your help. $\endgroup$ – Marius Jan 25 '17 at 7:50
  • $\begingroup$ I guess I could use some help. I've tried but failed miserably. $\endgroup$ – Marius Jan 25 '17 at 8:23
10
$\begingroup$

Here is a horrible attempt at ascii

 I1--+------------XOR-----O1
     |            |
     XOR----------O
     |            |
 I2--+------------XOR-----O2
Where the O marks the acid spot.

Explanation

The first XOR checks if the 2 inputs are different or not. If so, sends a 1. The other XOR change the signal if they received a 1 from the first XOR.
The oil spot blocked the switch signal from reaching the next XOR gates and therefore the change was not made.

$\endgroup$
  • $\begingroup$ @boboquack is this better? $\endgroup$ – stack reader Jan 25 '17 at 8:05
  • $\begingroup$ Yes, however Marius did answer first, so if he puts diagrams up, the checkmark will have to go to him. $\endgroup$ – boboquack Jan 25 '17 at 8:15
  • $\begingroup$ @boboquack. I'm not going to add a diagram, not because I don't want to, but because I can't. If this answer fits your requirements, you have my blessing to accept it. $\endgroup$ – Marius Jan 25 '17 at 9:59
1
$\begingroup$

Here's my solution First, the three gates are

All XOR gates

The are arranged such that

I1 and I2 are wired as inputs into an XOR gate, call the resultant wire M (for middle)
I1 and M are wired as inputs into an XOR gate, the resultant wire is O1
I2 and M are wired as inputs into an XOR gate, the resultant wire is O2

As a diagram, it looks like this:

I1--------XOR-O1 _XOR__/ / \ I2________XOR-O2

That satisfies the initial condition.

As for what the acid burned away, it would be the wire

Its the wire that exits the intial XOR gate before it splits to go into the two later XOR gates. That causes each subsequent XOR gate to have a 0 input, which makes the other input the output value. Hence, the XOR gate that outputs O1 is the result of 0 xor I1, which is I1, and the same for O2/I2

$\endgroup$
  • $\begingroup$ Welcome to Puzzling! Thanks for that answer! Unfortunately, this is the same as the other solutions :( Have you taken the site tour yet? $\endgroup$ – boboquack Jan 25 '17 at 21:52
  • $\begingroup$ It took a while to make the spoiler tags work. I got sniped! $\endgroup$ – Jesse Jan 25 '17 at 21:54
  • $\begingroup$ Here, we call it getting "ninja'd"! :D (No idea why...) $\endgroup$ – boboquack Jan 25 '17 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.