Combinator Contraptions
-
- Long Handed Inserter
- Posts: 56
- Joined: Wed Apr 13, 2016 10:39 am
- Contact:
Re: Combinator Contraptions
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.
-
- Fast Inserter
- Posts: 121
- Joined: Wed Apr 06, 2016 4:01 am
- Contact:
Re: Combinator Contraptions
Hi,
first: Nice thread and very helpfull people I like it
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?
first: Nice thread and very helpfull people I like it
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 :/Re: Combinator Contraptions
Solution: Tested with:terror_gnom wrote:task
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
-
- Fast Inserter
- Posts: 121
- Joined: Wed Apr 06, 2016 4:01 am
- Contact:
Re: Combinator Contraptions
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?
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?
Re: Combinator Contraptions
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.
-
- Fast Inserter
- Posts: 121
- Joined: Wed Apr 06, 2016 4:01 am
- Contact:
Re: Combinator Contraptions
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)
Re: Combinator Contraptions
Simply ( ) 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
https://en.wikipedia.org/wiki/Space–time tradeoff
Re: Combinator Contraptions
Here is a contraption that identifies a mystery signal and returns its unique ID.
-
- Fast Inserter
- Posts: 121
- Joined: Wed Apr 06, 2016 4:01 am
- Contact:
Re: Combinator Contraptions
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 )
Next task (I did already solve it via bruteforce, but I´m sure here will be postet a way more elegant solution )
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^^Re: Combinator Contraptions
After reading your task I was a little bit angry, because I thought that people have forgotten how to think using their own head.terror_gnom wrote:task Itemfilter
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: 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.
Re: Combinator Contraptions
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 in case of positives only)
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 in case of positives only)
-
- Fast Inserter
- Posts: 121
- Joined: Wed Apr 06, 2016 4:01 am
- Contact:
Re: Combinator Contraptions
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
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
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
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.
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
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
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.
Blueprint
Re: Combinator Contraptions
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'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.
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Combinator Contraptions
here is a hint if you want to build your ownNeotix 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.
2^X = (2^(X/2)) * (2^(X/2)) * [1 if X is even, 2 if X is odd]
Re: Combinator Contraptions
This hint explain nothing for me.
-
- Filter Inserter
- Posts: 813
- Joined: Fri Apr 29, 2016 5:27 pm
- Contact:
Re: Combinator Contraptions
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).Neotix wrote:This hint explain nothing for me.
Re: Combinator Contraptions
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
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.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.
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.Thank you ssilk!!ssilk wrote:Also one of currently interesting threads. So made it sticky.
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.
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
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.
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.
Added links to nice little helpers.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
Re: Combinator Contraptions
The diagrams are made with yEd, it's Freeware.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.
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