## Logic Gates (Without Combinators!)

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art , computers.
Neotix
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

### Logic Gates (Without Combinators!)

Logic Gates designs and 1st step to do something bigger. I'm using side inserters mod for more compact and faster design

-----------------------------------------------------------

Legend:
Green arrow - smart inserter
Blue arrow - fast inserter
P - Pole
WC - Wooden Chest
SC - Smart Chest
R - red circuit (R=1 mean 1 item in red circuit)
G - green circuit

-----------------------------------------------------------

A B | AND
0 0 | 0
0 1 | 0
1 0 | 0
1 1 | 1

A B | OR
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 1

A B | XOR
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 0

It's compact design, and output is TRUE when 2 items are in logistic system (1 item in each smart chest).
To set that 1 item is true, you can add buffer that will more item into Smart chest when Oputput =2 and remove it when Output < 2

A | NOT
0 | 1
1 | 0

A B | NAND
0 0 | 1
0 1 | 1
1 0 | 1
1 1 | 0

A B | NOR
0 0 | 1
0 1 | 0
1 0 | 0
1 1 | 0

A B | XNOR
0 0 | 1
0 1 | 0
1 0 | 0
1 1 | 1

It's compact design, and output is TRUE when 2 items are in logistic system (1 item in each smart chest).
To set that 1 item is true, you can add buffer that will more item into Smart chest when Oputput =2 and remove it when Output < 2

Ingame gated

T Flip-Flop
http://i.gyazo.com/669f2213093b645d5852359ff060b71b.mp4
On left you can see timer. Each time when item reach SmartChest it change logic state on output (lamps are turning on and off). It can be used as memory cell in more complex designs.

First design of Seven-segment display. Wires connections are ugly but after some tests l will make them prettier.
Last edited by ssilk on Mon Sep 19, 2016 10:35 pm, edited 3 times in total.
Reason: changed topic to fit subject better

-root
Filter Inserter
Posts: 651
Joined: Tue Jul 01, 2014 11:24 pm
Contact:

### Re: Logic Gates

Ok, so explain it like i'm 5... What are you aiming to achieve here?

Neotix
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

### Re: Logic Gates

I'm doing it just for fun because after over 500h in game, building next factory became boring.
Right now I want to build "clock". It won't show actual time but I want to build something what is not mainstream in the game.
Next it will be day counter
Maybe after that I will build more complex circuits like calculator or something.

luhem7
Manual Inserter
Posts: 4
Joined: Sun Nov 23, 2014 12:58 am
Contact:

### Re: Logic Gates

Oh man, this is how it starts you know... soon you will be implementing a full fledged computer in the game. What will you use for memory? Will you design latches? or are you going to use the presence/absence of items in boxes or something like that?

Edit: Woops sorry, I noticed that you mentioned memory in your post.

Neotix
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

### Re: Logic Gates

Just finished, 4bit synchronous counter

I have to build logic for display and to skip counting after 9 and set again on 0.

ssilk
Global Moderator
Posts: 10470
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

### Re: Logic Gates

Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

-root
Filter Inserter
Posts: 651
Joined: Tue Jul 01, 2014 11:24 pm
Contact:

### Re: Logic Gates

Neotix wrote:I'm doing it just for fun because after over 500h in game, building next factory became boring.
Right now I want to build "clock". It won't show actual time but I want to build something what is not mainstream in the game.
Next it will be day counter
Maybe after that I will build more complex circuits like calculator or something.
A clock like this?

A calculator or something would be really cool

NotABiter
Fast Inserter
Posts: 124
Joined: Fri Nov 14, 2014 9:05 am
Contact:

### Re: Logic Gates

luhem7 wrote:Oh man, this is how it starts you know... soon you will be implementing a full fledged computer in the game.
I was considering doing an in-game computer. I worked out an efficient way to deal with multi-bit values (storage, bitwise ops, and math ops) as well as how to do a "speedy" (to the extent the game allows) multi-port register file. But each piece of such a computer requires extensive configuration with respect to placing the right number and type of items (wood, coal, iron plate, etc.) in the right place, and currently blueprints do not capture that information so construction robots won't place the items for you, making such a construction on the scale needed to do a computer a lot more work than I am willing to do (and hopelessly error prone). Another option is to design the system to be "self booting" so to speak -- have extra parts whose sole purpose is to move items from mass/uniform storage to where they need to be such that you achieve some valid initial state, but this adds so much crap to the design (such reset pieces end up being the vast majority of the build) that it's just depressing to think about how space- and part-inefficient the final result is, plus it's a lot more design work. (I also have ideas for packet-based communication and packet-based routing of raw materials both by belt and train, making it possible for the computer to truly control a massive base, but they suffer from the same issues.) That just leaves making it via some Lua scripting, but that really seems like cheating.

It's kind of sad, because I was hoping to build my first multi-GW computer (maybe the first multi-GW computer in human history!).

Neotix
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

### Re: Logic Gates

I'm energeticist, not electronics so my knowledge about electronic designs is very limited. All I build in Factorio is based on simple knowledge and of course trials and fails. For me it's all fun in that to try something new, being creative event in ridiculous things
I don't think so that I'm able to build something such complex like computer just trying and without specialist knowledge.

Right now I want to build clock and day counter with digits display.

One problem that I had to face while building clock was that constant signal cause continuous states changes. To deal with it I had to build buffer that will send impulse signal. So now whet buffer detect signal (continuous or impulse) from Red wire it will send impulse. With that nest latch will change state once. Additional buffer can be locket by signal from green wire and it will help me to build setting system that will skip counting after 9 and set 0.

Neotix
Filter Inserter
Posts: 597
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

### Re: Logic Gates

Fully operating Seven-segment display

It will show how many items are in smart chest (from 0 to 9).
Connecting multiple displays with proper configuration in smart switches, it can show how many items are in storage

I used lamps but they're problematic. Now I'm using inserters and "no power icon" If i want to display "1", smart switches provide electricity to segments ADEFG and segments BC have no power.

Ironmarck
Manual Inserter
Posts: 2
Joined: Mon Nov 24, 2014 4:37 pm
Contact:

### Re: Logic Gates

NotABiter wrote:
luhem7 wrote:Oh man, this is how it starts you know... soon you will be implementing a full fledged computer in the game.
I was considering doing an in-game computer. I worked out an efficient way to deal with multi-bit values (storage, bitwise ops, and math ops) as well as how to do a "speedy" (to the extent the game allows) multi-port register file. But each piece of such a computer requires extensive configuration with respect to placing the right number and type of items (wood, coal, iron plate, etc.) in the right place, and currently blueprints do not capture that information so construction robots won't place the items for you, making such a construction on the scale needed to do a computer a lot more work than I am willing to do (and hopelessly error prone). Another option is to design the system to be "self booting" so to speak -- have extra parts whose sole purpose is to move items from mass/uniform storage to where they need to be such that you achieve some valid initial state, but this adds so much crap to the design (such reset pieces end up being the vast majority of the build) that it's just depressing to think about how space- and part-inefficient the final result is, plus it's a lot more design work. (I also have ideas for packet-based communication and packet-based routing of raw materials both by belt and train, making it possible for the computer to truly control a massive base, but they suffer from the same issues.) That just leaves making it via some Lua scripting, but that really seems like cheating.

It's kind of sad, because I was hoping to build my first multi-GW computer (maybe the first multi-GW computer in human history!).
Maybe you could use the blue logistics chest.
Just build the whole system disconected from the power network, give the robots the items from a red chest, remove the red chest and conect the power.

Yttrium
Long Handed Inserter
Posts: 81
Joined: Mon Jan 05, 2015 1:47 pm
Contact:

### Re: Logic Gates

NotABiter wrote:
luhem7 wrote:Oh man, this is how it starts you know... soon you will be implementing a full fledged computer in the game.
I was considering doing an in-game computer. I worked out an efficient way to deal with multi-bit values (storage, bitwise ops, and math ops) as well as how to do a "speedy" (to the extent the game allows) multi-port register file. But each piece of such a computer requires extensive configuration with respect to placing the right number and type of items (wood, coal, iron plate, etc.) in the right place, and currently blueprints do not capture that information so construction robots won't place the items for you, making such a construction on the scale needed to do a computer a lot more work than I am willing to do (and hopelessly error prone). Another option is to design the system to be "self booting" so to speak -- have extra parts whose sole purpose is to move items from mass/uniform storage to where they need to be such that you achieve some valid initial state, but this adds so much crap to the design (such reset pieces end up being the vast majority of the build) that it's just depressing to think about how space- and part-inefficient the final result is, plus it's a lot more design work. (I also have ideas for packet-based communication and packet-based routing of raw materials both by belt and train, making it possible for the computer to truly control a massive base, but they suffer from the same issues.) That just leaves making it via some Lua scripting, but that really seems like cheating.

It's kind of sad, because I was hoping to build my first multi-GW computer (maybe the first multi-GW computer in human history!).
Let me smash your dream even further, factorio is an very precise game exept that inserters ( And many more things ) will not go at the same speed if placed in another chunk, so building any sort of time tracking device will not ensure your entire computer is in sync with other parts which means you would have to be smart about your component placement especially when you try to compare things ( Like most logic gates do )

cube
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

### Re: Logic Gates

Inserters are as precise as everything else, the problem is that actions of entities in the game are not simultaneous and the order of the actions is not easily predicted (but it is completely deterministic).

For example two inserters taking from a single chest that is filled by a third inserter is problematic, because the situation might end up that one inserter takes, everything, the other takes everything, or something in between, depending on the order of building them and partially also on position in the world.

IMHO belts would be better for timing of logic gates, with inserters only having a single long window to take items (fast inserter taking from almost empty belt is easily predictable and no problem at all).

Bleda
Long Handed Inserter
Posts: 98
Joined: Sun Feb 02, 2014 6:58 pm
Contact:

### Re: Logic Gates

This is awesome. I especially like Neotix' seven segment display. There should be a LED object for this kind of stuff. Maybe even with configurable color.

With this you could create a calculator that actually displays the result... I don't know if I could do that, but I'm sure someone eventually will.

LordFedora
Filter Inserter
Posts: 310
Joined: Fri Nov 07, 2014 3:46 am
Contact:

### Re: Logic Gates

planned for 0.12.something

NotABiter
Fast Inserter
Posts: 124
Joined: Fri Nov 14, 2014 9:05 am
Contact:

### Re: Logic Gates

Ironmarck wrote:Maybe you could use the blue logistics chest.
That might just work. Thanks for the idea. I haven't been playing Factorio recently, but when I get back to it I'll see if that can be made to work in my designs.
Yttrium wrote:Let me smash your dream even further, factorio is an very precise game exept that inserters ( And many more things ) will not go at the same speed if placed in another chunk, so building any sort of time tracking device will not ensure your entire computer is in sync with other parts which means you would have to be smart about your component placement especially when you try to compare things ( Like most logic gates do )
Do you have more details on the nature of these chunk-to-chunk differences?

These differences would mean that even a fairly small bit of logic that normally works could fail if it just happened to be on a chunk boundary? (If so, that doesn't seem very nice.)

BTW, my designs don't currently rely on time tracking, but rather make use of a clock signal - but speed differences would still break that (i.e., if the clock generator is running too fast for other elements to keep up -- though as long as there is some limit on the slowness it should be fixable by artificially slowing down the clock generator).

You now have me worried about how red/green wire networks that cross multiple chunk boundaries might (mis)behave. (E.g., if there's a chance that signal propagation might experience single-game-tick delays at chunk boundaries. Though my current guess is that signal wires do not have a direction of propagation and are actually processed as monolithic entities by the game, so they're free of any "clock skew".) I'll have to do some tests when I get some time.
cube wrote:For example two inserters taking from a single chest that is filled by a third inserter is problematic
...otherwise known as a "race condition". I have enough experience in multi-threading, multi-processing and hardware design to not make a mistake quite as obvious as the one you describe. (Though there may be other pitfalls in "factorio logic" that I don't know about, such as the chunk issue Yttrium mentioned.)
Bleda wrote:There should be a LED object for this kind of stuff. Maybe even with configurable color.
I would be happy with being able to turn lights on and off at will (via red/green wire signals), even during the day. (Even ignoring using lights for computers, it's just annoying to have a nice bright factory... and then suddenly it gets real dark because, you know, the sun has started coming up. I'd rather burn the juice and run the lights all day than deal with that.)

Configurable color sounds cool though. Especially if that is dynamic (somehow based on red/green wire signals) so I could make an in game computer with a "full color" (4 or 8 colors) dot matrix display.

Blitz4
Burner Inserter
Posts: 6
Joined: Sat Mar 07, 2015 9:37 pm
Contact:

### Re: Logic Gates

LordFedora wrote:planned for 0.12.something
Whoa!

Blitz4
Burner Inserter
Posts: 6
Joined: Sat Mar 07, 2015 9:37 pm
Contact:

### Re: Logic Gates

Neotix wrote:Fully operating Seven-segment display

It will show how many items are in smart chest (from 0 to 9).
Connecting multiple displays with proper configuration in smart switches, it can show how many items are in storage

I used lamps but they're problematic. Now I'm using inserters and "no power icon" If i want to display "1", smart switches provide electricity to segments ADEFG and segments BC have no power.
Amazing!

Requires the Smart Circuit Systems mod (https://forums.factorio.com/forum/vie ... =14&t=6272)
I'm guessing this is what's being added to 0.12?

### Who is online

Users browsing this forum: No registered users