Combinator Contraptions
Re: Combinator Contraptions
Yes, the bug makes the output incorrect. It is designed for Factorio 0.12.27.
Edit: Still not fixed. Maybe Factorio 0.12.28...
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.
Re: Combinator Contraptions
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.
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.
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.
Re: Combinator Contraptions
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?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.
Re: Combinator Contraptions
Your task gave me an idea of interesting challenge:Amegatron wrote: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?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.
Signal delayer challenge
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
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.Amegatron wrote:Quotes
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.
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 wrote:Your task gave me an idea of interesting challenge:
Re: Combinator Contraptions
Right direction, keep going!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.
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
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.
Re: Combinator Contraptions
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 .
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
Oops! Good catch. It's fixed now.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 .
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.
Re: Combinator Contraptions
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.
Re: Combinator Contraptions
Sorry for harsh truth, but I think you should completely destroy your CPU and start building it from the very beginning.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.
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.
Re: Combinator Contraptions
So you are building a computer - Great!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.
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?
PS AFAIK the smallest chess program has about 1/4K of instructions, but that's X86 code
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.
Re: Combinator Contraptions
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 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.
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 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.
Re: Combinator Contraptions
I recommend you to use some pattern when you are asking for help with combinators... Like this: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.
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.XKnight wrote:MY TASK 2Signal delayer challenge
You task looks like:
Task
Am I right?Re: Combinator Contraptions
Yes, of course! Your (re)statement of the problem is correct, and I should have started with a formal problem statement ( my fault).Am I right?
- Dr. Walrus
- Long Handed Inserter
- Posts: 96
- Joined: Fri Nov 20, 2015 6:30 am
- Contact:
Re: Combinator Contraptions
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.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.
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.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).
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.
Re: Combinator Contraptions
2 ticks are really simple: Also, second "Blue*10M" combinator may be removed if input red wire can be modified.XKnight wrote:Task
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.
Re: Combinator Contraptions
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
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.
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
is actually what I intended (Duh!).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.
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.
Re: Combinator Contraptions
Ok, next time you will write requirements by yourself
Here is the solution for your renewed task:
Here is the solution for your renewed task:
Details
Tests
Blueprint
Re: Combinator Contraptions
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
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