PlumberPlumber, 244 176 bytes
[] [] []
][=][]
[]=][][=][
[]=]===]]
][]][=[=]] =]]
[]][ ][===[=[]
]][]=][[[=]=]][][
[]]=]=]=]=[]
][]=[]][
[]]=][=][]
= =]=]][[=[==
][=]=]=]=]===][=
Old Design (244 bytes)
[] []
[][=[]
[[=[][] [][] ][]][=
][[] ][[=]]]][]=[[]
[]===][] ][===][]
][][ [] ][ ] [][]
[ ][]=][[[===][[
][]]]=][[]=[=]=]=]]==]=]][
][=]=]]==]=][] ][
[][=][=[[][[=]][
==]=]][[=[= =
I thought I had a good solution for a while...except it didn't work with 0
or 1
as the first input. This program consists of three parts: incrementer, decrementer, and outputter.
The decrementer is on the left, and holds the first value. It is incremented, since a 0
would cause an infinite loop (as the program tries to decrement to 0
and gets a negative value). It will decrement the stored value at execution, and send a packet to the incrementer.
The incrementer is on the right, and stores the second input. When the decrementer sends a packet, it increments its stored value, and sends a packet back to the decrementer.
Whenever the decrementer sends the packet to the incrementer, it is checked by the outputter. If the packet is 0
, execution stops and the value of the incrementer is read and outputted. It uses a NOT gate, one of the most complicated parts of the program.
Older design (doesn't work with some inputs), 233 bytes
[] []
[][] [][] =][]
[]=][]=][[=]][
[][===][ [][===[]
[][] [ [] ][][
] [===][=]][ ]
][[=[=[=[=[=]=[]][=[[[][
][[=[=[=[==[[=[=][
[]]=][=][]
= =]=]][[=[==
The new one is flipped to save bytes, and it's really confusing me. This design is the one I worked with for a week or so when designing the interpreter.