Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. --- Day 7: Some Assembly Required ---
  2.  
  3. This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
  4.  
  5. Each wire has an identifier (some lowercase letters) and can carry a 16-bit signal (a number from 0 to 65535). A signal is provided to each wire by a gate, another wire, or some specific value. Each wire can only get a signal from one source, but can provide its signal to multiple destinations. A gate provides no signal until all of its inputs have a signal.
  6.  
  7. The included instructions booklet describes how to connect the parts together: x AND y -> z means to connect wires x and y to an AND gate, and then connect its output to wire z.
  8.  
  9. For example:
  10.  
  11. 123 -> x means that the signal 123 is provided to wire x.
  12. x AND y -> z means that the bitwise AND of wire x and wire y is provided to wire z.
  13. p LSHIFT 2 -> q means that the value from wire p is left-shifted by 2 and then provided to wire q.
  14. NOT e -> f means that the bitwise complement of the value from wire e is provided to wire f.
  15. Other possible gates include OR (bitwise OR) and RSHIFT (right-shift). If, for some reason, you'd like to emulate the circuit instead, almost all programming languages (for example, C, JavaScript, or Python) provide operators for these gates.
  16.  
  17. For example, here is a simple circuit:
  18.  
  19. 123 -> x
  20. 456 -> y
  21. x AND y -> d
  22. x OR y -> e
  23. x LSHIFT 2 -> f
  24. y RSHIFT 2 -> g
  25. NOT x -> h
  26. NOT y -> i
  27. After it is run, these are the signals on the wires:
  28.  
  29. d: 72
  30. e: 507
  31. f: 492
  32. g: 114
  33. h: 65412
  34. i: 65079
  35. x: 123
  36. y: 456
  37. In little Bobby's kit's instructions booklet (provided as your puzzle input), what signal is ultimately provided to wire a?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement