Page 1 of 1

Logic Gates 1 (Without Combinators!)

Posted: Fri Mar 01, 2013 12:25 pm
by Heinrich
I saw that post about memory cells yesterday, which is great. It inspired me to think about some more logic elements with smart inserters/chests. Since we have the base elements, named signal, negation and something which reacts to it, it is possible to create basic logical gates.

First thing i came up is a NOR gate. If you put at least one of two items (A OR B), in the chest to the right, the output (Q) will change from 1 to 0. The other way around, if none of A and B is in the chest, the output is 1. Of course one single bit item (fish is usually good) has to be put into the gate's chest to keep it working.

Image



The AND gate is derrived from the NOR gate by the following boolean formula: !( A or B ) = !A and !B
So i inverted the four inserters of the gate and negated the output. It turns 1 for the chest to the right holding both items, A AND B.

Image



Of curse the gates are stackable and we can create things like: Only insert coal into the furnace, if there are no gears OR ammo AND more than 100 iron ore are avaiable. The two express belts could be replaced with fast inserters, which would make the gate a little faster. But it uses less energy this way and a nother electric pole would be needed.

Re: Logic Gates

Posted: Sat Mar 02, 2013 12:12 pm
by Mysteria9
Great work, fantastic!

Re: Logic Gates

Posted: Sat Mar 02, 2013 11:00 pm
by Heinrich
I created another element: An edge detector.

If an item A is placed in the green box, the circuit in the center creates a single tick Q. If A is removed again, the detector resets, without generating a signal. A bit item has to be placed in the upper right wooden box. Note that the output has it's own "cable space".

The problem here was the inserter, which takes the bit item from the output box. The item is removed during the same tick as it is placed, without moving in to the container and no signal is generated. I made it reacting to the output signal, which ensured the item staying in the box for one tick.

Image



I used a modified version of this device to create an item counter. The belt to the upper right transports iron ore, which is moved through a green box via two smart inserters. Both are configurated to store at maximum one item in the box for at least one tick. The signal is than transfered to the edge detector, which only reacts to the put-in-event. It triggers the smart inserter to the lower left, which moves as many items from the wooden to the yellow box, as were moving on the belt.

A second bit item has to be stored in the upper wooden box, to ensure every inserted iron ore is recognized.

Image

Re: Logic Gates

Posted: Sun Mar 03, 2013 7:45 am
by Mark
Great designs! I like where this is going :)

Re: Logic Gates

Posted: Sun Mar 03, 2013 10:57 am
by Mysteria9
Mark wrote:Great designs! I like where this is going :)
Couldn't agree more! Soon we'll be playing factorio inside factorio! :shock: