Page 3 of 6
Re: Combinator Contraptions
Posted: Thu Apr 21, 2016 10:15 am
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 !!!
Re: Combinator Contraptions
Posted: Fri Apr 22, 2016 11:04 am
by terror_gnom
Hi,
first: Nice thread and very helpfull people
![Smile :)](./images/smilies/icon_e_smile.gif)
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?
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
Posted: Fri Apr 22, 2016 4:10 pm
by XKnight
Solution:
![2.png](./download/file.php?id=10294)
- 2.png (217.64 KiB) Viewed 9037 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"
Re: Combinator Contraptions
Posted: Fri Apr 22, 2016 9:55 pm
by terror_gnom
thanks for the quick answer, I like the idea
![Smile :)](./images/smilies/icon_e_smile.gif)
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?
Re: Combinator Contraptions
Posted: Sat Apr 23, 2016 2:22 am
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.
Re: Combinator Contraptions
Posted: Sat Apr 23, 2016 7:14 am
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)
Re: Combinator Contraptions
Posted: Sat Apr 23, 2016 7:28 am
by DaveMcW
Simply (
![Laughing :lol:](./images/smilies/icon_lol.gif)
) 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
Re: Combinator Contraptions
Posted: Sun Apr 24, 2016 11:01 am
by DaveMcW
Here is a contraption that identifies a mystery signal and returns its unique ID.
![signal.jpg](./download/file.php?id=10367)
- signal.jpg (380.7 KiB) Viewed 8921 times
Re: Combinator Contraptions
Posted: Mon Apr 25, 2016 2:10 pm
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
![Razz :P](./images/smilies/icon_razz.gif)
)
*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
Posted: Mon Apr 25, 2016 7:53 pm
by XKnight
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](./download/file.php?id=10418)
- 2.png (182.3 KiB) Viewed 8859 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"
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.
Re: Combinator Contraptions
Posted: Mon Apr 25, 2016 8:12 pm
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
![Laughing :lol:](./images/smilies/icon_lol.gif)
in case of positives only)
![cmemroy.jpg](./download/file.php?id=10422)
- cmemroy.jpg (36.59 KiB) Viewed 9062 times
Re: Combinator Contraptions
Posted: Tue Apr 26, 2016 4:05 pm
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
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.
![test.png](./download/file.php?id=10443)
- test.png (751.77 KiB) Viewed 9031 times
Re: Combinator Contraptions
Posted: Wed May 25, 2016 6:26 pm
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.
Re: Combinator Contraptions
Posted: Thu May 26, 2016 10:27 am
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]
Re: Combinator Contraptions
Posted: Thu May 26, 2016 7:50 pm
by Neotix
This hint explain nothing for me.
Re: Combinator Contraptions
Posted: Thu May 26, 2016 11:16 pm
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).
Re: Combinator Contraptions
Posted: Wed Jun 01, 2016 1:10 am
by ssilk
Also one of currently interesting threads. So made it sticky.
Re: Combinator Contraptions
Posted: Thu Jun 02, 2016 5:23 am
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.
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!!
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.
Re: Combinator Contraptions
Posted: Wed Jun 08, 2016 9:06 am
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.
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
![Wink ;)](./images/smilies/icon_e_wink.gif)
Added links to nice little helpers.
Re: Combinator Contraptions
Posted: Thu Jun 09, 2016 8:32 pm
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.