Combinator Contraptions

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.
Please provide if possible always a blueprint of your creation.
Killavirus
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Wed Apr 13, 2016 10:39 am
Contact:

Re: Combinator Contraptions

Post by Killavirus »

This thread scares me, Not only do I have no idea whats going on I know one day I am going to test this out, My addiction is bad enough as is, WTF is going to happen to me on the day that I start to understand and use these !!!
Addiction Thy Name be Factorio, FACTORIO IS NOT A LIE.
terror_gnom
Fast Inserter
Fast Inserter
Posts: 121
Joined: Wed Apr 06, 2016 4:01 am
Contact:

Re: Combinator Contraptions

Post by terror_gnom »

Hi,
first: Nice thread and very helpfull people :) I like it :D

I like to build some kind of logistic network with trains. For this purpose I need to find the biggest and smallest amount for each Item. (smallest is easy because max > 0, min < 0 so its just a matter of changing the sign)
My first thought was: Pretty easy, just do if each > each output each itemcount, but that clearly doesnt work :(

I want to build it scalable for up to 1023 signals (I dont like the 0 in factorio^^).
To preserve the address of the signal, I code the address in the 10 least significant bits of each item, so dont change these ;)

So to sum it up:
each value per Item is unique (even with the same itemcount, the address in the 10 lsb will make them distinguishable)
there will be a max > 0 (and min < 0)

Question: Is there a way to build it without building a comperator for each Item?
task
A thought that came at the moment: Maybe some kind of sorting algorithm with a second, sorted memorystack. It needs to handle 2 different update-cycles though (1024 ticks/update from the train stations and 30-60 ticks/update from the controller). I need to think about that... probably its way to slow and doesnt save any combinators :/
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

terror_gnom wrote:
task
Solution:
2.png
2.png (217.64 KiB) Viewed 9669 times
Tested with:
Input: 120 "0", 50 "1"; 12 "0" 650 "1" Output: 120 "0", 650 "1"
Input: 1120 "0", 510 "1"; 1232 "0" 610 "1" Output: 1232 "0", 610 "1"
Details
Blueprint
terror_gnom
Fast Inserter
Fast Inserter
Posts: 121
Joined: Wed Apr 06, 2016 4:01 am
Contact:

Re: Combinator Contraptions

Post by terror_gnom »

thanks for the quick answer, I like the idea :) would have never thougth about testing the difference against zero.

Another question I probably know the answer (NO!):

My brother (2nd semester software engineering) told me, the comparison of the memory blocks can be handled in at least n log n steps, with the build in parallelisation of factorio its down to log n (so with 1024 cells 10 ticks). is there a possibility to utilize the parallelisation further?
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Combinator Contraptions

Post by DaveMcW »

You would have to explain the exact task you are trying to accomplish in log(n) ticks. But for some tasks, you can use 1024 combinators to sort everything in one tick.
terror_gnom
Fast Inserter
Fast Inserter
Posts: 121
Joined: Wed Apr 06, 2016 4:01 am
Contact:

Re: Combinator Contraptions

Post by terror_gnom »

I have 2^10 memory cells and want to find the biggest stored value (my own logik tells me, that you need at least 10 comparisons)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Combinator Contraptions

Post by DaveMcW »

Simply ( :lol: ) build a million >= operators, count each row of the 1024x1024 table, and select the row that scored a perfect 1024. In theory it is possible, in practice maybe parallelization isn't the best answer.

https://en.wikipedia.org/wiki/Space–time tradeoff
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Combinator Contraptions

Post by DaveMcW »

Here is a contraption that identifies a mystery signal and returns its unique ID.
signal.jpg
signal.jpg (380.7 KiB) Viewed 9553 times
terror_gnom
Fast Inserter
Fast Inserter
Posts: 121
Joined: Wed Apr 06, 2016 4:01 am
Contact:

Re: Combinator Contraptions

Post by terror_gnom »

Is Dr. Walrus still with us, so he can probably add all those nice little helpers to to first post? Probably someone is looking for it and doesnt like to check every page in this topic ;)

Next task (I did already solve it via bruteforce, but I´m sure here will be postet a way more elegant solution :P)
task Itemfilter
*edit* Can you tell me, what tool you use for the schematic? I like to use them for my build. If you just build it ingame, it gets incredibly confusing and after 2 days you have no clue how it works or even what it does^^
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

terror_gnom wrote:
task Itemfilter
After reading your task I was a little bit angry, because I thought that people have forgotten how to think using their own head.
But later I calmed down and found this task quite interesting...

Obvious solution which definitely you should have to implement by yourself:
- transform each signal to 1 using (Each > -GG, Output: Each, 1)
- collect these values from A and B, check whether they are equal to 2
- multiply these signals with G
- calculate sum "A + dummy constant -G + multiplied value" and check is it bigger than 0
(some adjustments are needed if you want to work with negative values).
This solution requires 4 ticks and 5 combinators + 3 dummy combinators to propagate A to the last step.

Non-obvious solution:
2.png
2.png (182.3 KiB) Viewed 9491 times
Tested with:
Input A: 120 "A", -1234 "B", 4 "C", 10 "D", 9 "E"
Input B: "1" C, 50 "D", 12 "B", 80 "F"
Output: 10 "D", 4 "C", -1234 "B"
Details
Blueprint
You can use any diagramming software to clearly describe your builds (most popular apps).
Personally, I am using yEd for my designs, this app is free, cross-platform, and has a nice automatic layout feature.
Last edited by XKnight on Mon Apr 25, 2016 8:58 pm, edited 1 time in total.
piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

Here's a scheme for a cheap memory capable of storing all the signals (albeit with a reduced range)
Caveats:
- incoming signals must be 1 tick wide
signals must be conditioned:
-if negative values are desired and interval is 10M then 5M must be added to the incoming and 5M subtracted from the output
-for positive only values 1 could be added to the input and 1 subtracted from the output.
- signals cannot be erased from the storage (but that's not a problem as 5M = 0 in case of negatives, and 1=0 :lol: in case of positives only)
cmemroy.jpg
cmemroy.jpg (36.59 KiB) Viewed 9683 times
terror_gnom
Fast Inserter
Fast Inserter
Posts: 121
Joined: Wed Apr 06, 2016 4:01 am
Contact:

Re: Combinator Contraptions

Post by terror_gnom »

Sorry XKnight, it wasn´t my intention to offend you. Somehow I just cant get my brain right for those combinators... Probably its the same reason why I hate electrical engeneering :P

And the question for the tool was somehow stupid... I thought its some kind of electrical/logical CAD software, where you can simulate it in one go :lol:


Here is my first contraption:
I used it to check how many ticks my train station requieres to empty a train.

It finds the max and min period length (rising edge to rising edge) of a Signal A and outputs it as max = red wire B, min = - green wire B
I´m sure, there are way smarter and easier ways for doing so, but it works :P

To reset just add a negative signal B thats definitly longer than the min you´re expecting to find in the constant combinator and remove it again.
test.png
test.png (751.77 KiB) Viewed 9652 times
Blueprint
Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: Combinator Contraptions

Post by Neotix »

Can somebody explain how The Exponent Calculator works?
I can't use blueprint because when I import it and place in game it's messed up.
I want to use it to calculate 2^X.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Combinator Contraptions

Post by ratchetfreak »

Neotix wrote:Can somebody explain how The Exponent Calculator works?
I can't use blueprint because when I import it and place in game it's messed up.
I want to use it to calculate 2^X.
here is a hint if you want to build your own

2^X = (2^(X/2)) * (2^(X/2)) * [1 if X is even, 2 if X is odd]
Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: Combinator Contraptions

Post by Neotix »

This hint explain nothing for me.
Frightning
Filter Inserter
Filter Inserter
Posts: 813
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Combinator Contraptions

Post by Frightning »

Neotix wrote:This hint explain nothing for me.
Here's a hint to the hint: Combinator division always truncates answers to integer part (so 13/2=6.5=6), with that in mind, look at the previous hint (and use exponent laws to see why it works).
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Combinator Contraptions

Post by ssilk »

Also one of currently interesting threads. So made it sticky.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: Combinator Contraptions

Post by Dr. Walrus »

Neotix wrote:Can somebody explain how The Exponent Calculator works?
I can't use blueprint because when I import it and place in game it's messed up.
I want to use it to calculate 2^X.
I can explain it to you. Those other replies may have been correct, but they were describing a totally different method than I used. The way this contraption calculated exponents is by taking an input of signal 0, and multiplying it by 1 blue. That result is then changed to signal blue and looped back around and multiplied against the original number of signal 0 again. This gives the square of the number of signal 0. This loop is performed X times where X is the number of signal 1 you set. The consequence of calculating it this way is that your result takes more ticks to calculate the larger your exponent is.

That's the theory of how it works, and most of the combinators are there just for timing and getting a readout that doesn't blink. Here are build instructions for you to build the exact thing in the picture while I fix all of these blueprints.
HOW TO BUILD IT YOURSELF
Also try downloading the latest version of the blueprint string mod. It claims to be able to fix old blueprints. I haven't tried it yet though.

ssilk wrote:Also one of currently interesting threads. So made it sticky.
Thank you ssilk!! :D :D :D
I am glad this topic has generated such good discussions. I'm looking forward to the great things I will see everyone build when 0.13 comes out! And I will try my best to keep building cool contraptions myself. The next one I have in mind is a contraption that can calculate X/Y and give the answer to 10 decimal points.
User avatar
Dr. Walrus
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Nov 20, 2015 6:30 am
Contact:

Re: Combinator Contraptions

Post by Dr. Walrus »

I was bored waiting for 0.13 to come out so I went ahead and built the ultra precise division machine. The blueprint string for it was made in 12.30 so it won't work for most people who have updated to 12.31 and above.

I've been wanting to post diagrams that have a written description of combinator settings and where the wires go like these diagrams I've seen piriform and XKnight post. That way you don't need to have a blueprint string to build it yourself.
Image
I don't really have any idea of what software or whatever is used to make these so any help or recommendations on what to use would be great.
terror_gnom wrote:Is Dr. Walrus still with us, so he can probably add all those nice little helpers to to first post? Probably someone is looking for it and doesnt like to check every page in this topic ;)
Added links to nice little helpers.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Combinator Contraptions

Post by siggboy »

Dr. Walrus wrote:I've been wanting to post diagrams that have a written description of combinator settings and where the wires go like these diagrams I've seen piriform and XKnight post. That way you don't need to have a blueprint string to build it yourself.
I don't really have any idea of what software or whatever is used to make these so any help or recommendations on what to use would be great.
The diagrams are made with yEd, it's Freeware.

I've used it too, it's really good (actually amazing considering it's free). Make sure you use the automatic layout features.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Post Reply

Return to “Combinator Creations”