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.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Combinator Contraptions

Post by DaveMcW »

Yes, the bug makes the output incorrect. It is designed for Factorio 0.12.27. :D

Edit: Still not fixed. :( Maybe Factorio 0.12.28...
Last edited by DaveMcW on Sun Mar 20, 2016 6:26 pm, edited 2 times in total.

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

The following is NOT a solution that was asked for, but may be of use to some as it deals with a similar type of a problem. Specifically, how to quickly time sort many signals into relatively few time slots. There are 5 time slots In the diagram, although the circuit can be extended indefinitely provided one is willing to pay for 2 deciders per additional slot.
sts.jpg
sts.jpg (41.09 KiB) Viewed 11507 times
How it works. The signals value correspond to the desired time slot. All the signals are dumped into the sorter in a pulse 1 tick wide. The deciders on the left select all the signals that belong in the desired time slot and inject them into the delay line formed by the deciders on the right.

Amegatron
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Sun Mar 06, 2016 4:12 am
Contact:

Re: Combinator Contraptions

Post by Amegatron »

Dr. Walrus wrote:This one is a little more specific. It inputs the rising edge of a signal, and outputs it later after being delayed by a custom number of ticks. The tick length of the delay is set by the value of the blue signal in the top-right constant combinator. For this contraption to work properly It has to receive a signal with at least 1 positive number and It can't contain any blue signals. The minimum delay is 5 ticks, and the maximum is 99,999,999 in case you want to input a signal and have it output once you finish college.
Damn, this is what I was looking for. But still I cannot understand how does it work :/ I've already started a topic nearby about delayed pulse generator. Seems your solution could help me. Could you please explain or maybe just post this layout more spaced so I could clearly see all wires?

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

Amegatron wrote:
Dr. Walrus wrote:This one is a little more specific. It inputs the rising edge of a signal, and outputs it later after being delayed by a custom number of ticks. The tick length of the delay is set by the value of the blue signal in the top-right constant combinator. For this contraption to work properly It has to receive a signal with at least 1 positive number and It can't contain any blue signals. The minimum delay is 5 ticks, and the maximum is 99,999,999 in case you want to input a signal and have it output once you finish college.
Damn, this is what I was looking for. But still I cannot understand how does it work :/ I've already started a topic nearby about delayed pulse generator. Seems your solution could help me. Could you please explain or maybe just post this layout more spaced so I could clearly see all wires?
Your task gave me an idea of interesting challenge:
Signal delayer challenge

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 »

Amegatron wrote:
Quotes
I've been a bit busy with work lately and I'm away from my factorio computer so I'll give you a quick rundown on how it works. IF you are still confused I'll post a complete breakdown in a few days.

The input signal is run through a 1 tick limiter that only outputs the first tick of a signal. It is then run through a memory cell, which is connected to the output. When the input signal passes through the 1 tick limiter it then gets stored in the memory cell and simultaneously starts a clock that goes up by 1 every tick. The clock keeps going up until it hits the user specified value of how many ticks you want to delay the signal. When this happens, simultaneously the memory cell is told to output its contents and clear its memory (which generates a 1 tick pulse for the output) and the clock gets reset.

It's a fairly kludgy design and there's probably better ways to set up the internal logic to reduce the number of combinators.
XKnight wrote:Your task gave me an idea of interesting challenge:
That's quite an interesting challenge again XKnight. In your example, it seems like you would need at least 7 memory cells, one to save the value of each individual tick in the input signal. Waiting a variable amount of time wouldn't be too hard, just affix a blue signal of the value of the input tick to each input and then output when a clock = that signal + user selected delay. However if you wanted to use less memory cells than the number of individual ticks, that would be tricky. You would have to encode your signals somehow so multiple signals could fit on the same combinator. hmmmm... Once again you've given me another idea for my next combinator contraption, but an elegant solution to your challenge eludes me.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

Dr. Walrus wrote:You would have to encode your signals somehow so multiple signals could fit on the same combinator. hmmmm... Once again you've given me another idea for my next combinator contraption, but an elegant solution to your challenge eludes me.
Right direction, keep going! :)

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've just posted a new contraption, The Basic Encoder. It takes any individual signal under 10M and changes it into a single blue signal that contains both the type and value of the signal. This one could be the starting point of a device that allows you to store multiple signals of the same or of different types in one memory cell if you have those signals encode as different item depending on their order.

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

I could not load blue print due to error: Unknown entity basic-pressure-plate. In the meantime my WAG is that you are using a form of Godelization 8-) .

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 »

piriform wrote:I could not load blue print due to error: Unknown entity basic-pressure-plate. In the meantime my WAG is that you are using a form of Godelization 8-) .
Oops! Good catch. It's fixed now.
And yes it does use Godel numbering, but only in the most primitive sense of the concept. The amount of the input signal is just converted to blue, and the type of the signal is converted into a number where wooden chest = 1, iron chest = 2, etc. and then multiplied by 10M. When added together the amount of the blue signal contains both the type and amount of the signal without going over the game's 32 bit signed integer limit. Using the true Godel numbering system with the product of a series of primes raised to the numbers you wish to encode would be huge, slow and really cool but would probably go over the integer limit really quickly. And the decoder would require me to build a contraption that calculates the nth root [ x^(1/n)] which is too big of an undertaking for me.

*Edit to avoid double posting*
Since I accidentally included pressure plates in my last contraption, the next contraption is all about pressure plates. The pressure plate stopwatch, for when you want to play factorio at 6:00 but you've got a track meet at 4:30.

Black Ice
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Apr 13, 2016 10:55 pm
Contact:

Re: Combinator Contraptions

Post by Black Ice »

This is my first attempt at a computer in factorio. It's 256, 5 by 7 displays arranged in a 16 by 16 grid and it can type, by placing copper plates in the "keyboard", do very basic maths and algebra and has some basic memory. Was hoping to put in a game next (chess??) and any advice would be appreciated. :D
Computer in Factroio.png
Computer in Factroio.png (6.82 MiB) Viewed 11202 times

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

Black Ice wrote:This is my first attempt at a computer in factorio. It's 256, 5 by 7 displays arranged in a 16 by 16 grid and it can type, by placing copper plates in the "keyboard", do very basic maths and algebra and has some basic memory. Was hoping to put in a game next (chess??) and any advice would be appreciated. :D
Computer in Factroio.png
Sorry for harsh truth, but I think you should completely destroy your CPU and start building it from the very beginning.
Fortunately, Factorio is not Minecraft, and you really don't need to put thousands kilometers of wires/redstones to build something with combinators. Here we have a lot more possibilities, but not all of them are obvious. Instead of building something huge you can try to create something smart, this will be much more interesting and you will recieve a good experience.

I admire your persistence and patience, but you've chosen the wrong path. The best what you can do is to go back and try again.

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

This is my first attempt at a computer in factorio. It's 256, 5 by 7 displays arranged in a 16 by 16 grid and it can type, by placing copper plates in the "keyboard", do very basic maths and algebra and has some basic memory. Was hoping to put in a game next (chess??) and any advice would be appreciated. :D
So you are building a computer - Great!
And you published your 1st attempt- Even Better! ( I wish more people would- Hopefully we can all learn what works well and what does not)
Are you looking for specific feedback or just proud that the darn thing works? :D

PS AFAIK the smallest chess program has about 1/4K of instructions, but that's X86 code :roll:
the piece position evaluation loops more than 4000 times per move at say 20 instruction/loop. How much time do you have?
Last edited by piriform on Mon Apr 18, 2016 4:56 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 »

Dr. Walrus encoding/decoding method led me to create a mux circuit in which a value of a specific signal can be selected from several (many) signals, via numeric address (1..N).
EDIT ------
XKnight kindly provided a more complete description of requirements (in lieu of the above vagueness). In summary, the circuit selects one of multiple input signals via number (address) and outputs a value of that (selected) signal.
I should probably add the following:
- The address range is 1..N where N is the number of selectable input signals, however successive addresses need not be consecutive (ex. the following address sequence should be valid 1,4,5,10 ,1,12.. etc).
-Delay of several (< 6) ticks between successive addresses is acceptable.
--------

This is what the mux looks like
mux.jpg
mux.jpg (33.12 KiB) Viewed 10925 times
The leftmost constant contains interval separated signals (to be muxed) . i.e. if the interval is 10M then 1st signal will have a value of 10M second 20M etc.
These values are added to the input signals that come in via red wire into an adder with setting Each+0:Each, and adder above that inverts (i.e. each*-1:each) the signals and the intervals.
Address (blue) comes in via green wire (on the left), is multiplied by the interval (i.e. 10M) in the bottom adder, then fed into decider (Each> blue: Each) and the two arithmetic conbinators ( Each+0:Each, Each-Blue:Green). Address is also incremented and inverted (i.e. Blue+1 *-1:Blue) by the adder below the constant and then fed to a decider (Each<Blue:Each).
The outputs of the two deciders are summed then fed into a final adder that normalizes the result (Each-Blue: Green).

While this circuit works, the biggest problem I have with it is the speed. Unfortunately I need a 1 tick solution and this circuit can only do 3. I don't think a 1 tick solution is possible but would love to be proven wrong.
blueprint string
Last edited by piriform on Mon Apr 18, 2016 1:45 am, edited 1 time in total.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

piriform wrote:While this circuit works, the biggest problem I have with it is the speed. Unfortunately I need a 1 tick solution and this circuit can only do 3. I don't think a 1 tick solution is possible but would love to be proven wrong.
I recommend you to use some pattern when you are asking for help with combinators... Like this:
XKnight wrote:
MY TASK 2
Signal delayer challenge
Because it is not so easy to understand what is needed when you already present your solution. Also, given solution may knock off from the right way.

You task looks like:
Task
Am I right?

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

Am I right?
Yes, of course! Your (re)statement of the problem is correct, and I should have started with a formal problem statement ( my fault).

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 »

Black Ice wrote:This is my first attempt at a computer in factorio. It's 256, 5 by 7 displays arranged in a 16 by 16 grid and it can type, by placing copper plates in the "keyboard", do very basic maths and algebra and has some basic memory. Was hoping to put in a game next (chess??) and any advice would be appreciated. :D
Awesome work. You should post your own forum topic and maybe post a blueprint string or download link so we could see a more in depth view of your computer in action. While I think chess is definitely possible, it's a big step up from snake or tetris which other guys have made in the past. At least with chess the game doesn't move on its own so you wouldn't have to optimize your computer for speed. You could take 100 game ticks for the computer to calculate a move without hindering the players ability to play.
piriform wrote:Dr. Walrus encoding/decoding method led me to create a mux circuit in which a value of a specific signal can be selected from several (many) signals, via numeric address (1..N).
Could you post a blueprint string of your contraption so far so I could see how it works. And I agree with XKnight, with the wording you have now it's a little difficult to to understand what you are trying to accomplish.

My guess is:
Tick 1: Input A = (54 Wooden Chest, 22 Iron Chest, 22 Steel Chest, 10 Smart Chest), Input B = (1 Signal Blue)
Tick 2: Output = (54 Wooden Chest) <-- First signal type in order if Wooden Chest corresponds to 1, Iron Chest to 2, Steel chest to 3, etc.

or is it like this:
Tick 1: Input A = (54 Wooden Chest, 22 Iron Chest, 22 Steel Chest, 10 Smart Chest), Input B = (3 Signal Blue)
Tick 2: Output = (22 Signal Blue) <-- Value of third signal type in order if Wooden Chest corresponds to 1, Iron Chest to 2, Steel chest to 3, etc.

Doing this in 1 tick is might be tricky, 2 ticks seems very doable because I think the encoder part of my encoder/decoder combo does something pretty similar in the first 2 ticks it receives the signal.

*EDIT* I was writing this post when you replied to XKnight's question.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

XKnight wrote:
Task
2 ticks are really simple:
1.png
1.png (45.78 KiB) Viewed 10838 times
Also, second "Blue*10M" combinator may be removed if input red wire can be modified.

By the way, it looks like this task can be completed in 1 tick only when "Blue" has 10M, 20M, 30M values (instead of 1,2,3).
Probably better results will be achieved when input system will be included in task.

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

Nice, clean design, but I have to apologize for wasting your and everybody's time (again).
I read your spec (on a remote monitor) and saw this
Input: 123 "A" , 0000246 "B", 0000500 "C", 2 "Blu
instead of
Input: 123 "A" , 10000246 "B", 20000500 "C", 2 "Blu
i.e. I thought you had zero padded B & C values. So DR. Walrus question
or is it like this:
Tick 1: Input A = (54 Wooden Chest, 22 Iron Chest, 22 Steel Chest, 10 Smart Chest), Input B = (3 Signal Blue)
Tick 2: Output = (22 Signal Blue) <-- Value of third signal type in order if Wooden Chest corresponds to 1, Iron Chest to 2, Steel chest to 3, etc.
is actually what I intended (Duh!).

The intended application for this is a computer input port which will collect external factory signals (i.e. ores, plates, products etc). Conventional translate,select technique requires 2 combinators per signal which can quickly add up. This method would allow signal collection at a lower cost.
In this particular application I don't have any leeway in timing. It's 1 tick or nothing, so I'm falling back to plan B which involves issuing successive addresses and reading the previous (already derived signal value). Given a fixed signals list this will entail 1 extra read instruction ( "preset") and does not appear too expensive. By using this method , actual mux delay will not matter provided the timing between successive reads is greater than that of a mux.

Even though this is a specific application for a multiplexer, I do think that this type of a circuit (and a corresponding demultiplexer) will find other uses. Once again, thanks for all the help and apologies for lack of clarity.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Combinator Contraptions

Post by XKnight »

Ok, next time you will write requirements by yourself :D

Here is the solution for your renewed task:
1.png
1.png (167.68 KiB) Viewed 10806 times
Details
Tests
Blueprint

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Combinator Contraptions

Post by piriform »

I don't have time to test it right now but it looks Really Good.

I think that this approach will be very useful. Off the top of my head I can think of the following apps
1. Input port
2. Your memory "compactification" scheme reader
3. A big one- Lookup Tables - fix the inputs in a constant and select arbitrary values in a sequence -alphabet anyone?
4.couple of these , a binary decoder, a bit of glue (and a lot of lights) and you have a very nice status display

Thanks again

Post Reply

Return to “Combinator Creations”