Page 4 of 6

Re: Combinator Contraptions

Posted: Fri Jun 17, 2016 4:27 pm
by Guu
circuit that can filter out a predetermined signal or signals from the total flux

Re: Combinator Contraptions

Posted: Fri Jun 17, 2016 7:20 pm
by siggboy
Here's a special purpose register that will accept any signal (or set of signal during the same tick), and then block any further writes until the "erase" signal is applied.

The erase signal is "Red" in the diagram, but could of course be changed if you actually need to store "Red" signals in your application.

The only other caveat is that you cannot store the value "-2^31", it's possible to change this if necessary; left as an exercise for the reader.

This register can handle 1-tick inputs, but it will also accept "hold" signals. It does not matter since all writes are blocked after the first tick of input. Just throw a signal at it and it will store it (forever/until reset).

I'm using this setup in my train scheduler, where I poll the outposts and need to accept one value (the first one that appears on the wire) and then process it -- so I want to block further writes to the register until the processing is finished. Other applications are surely possible.

You can put a 2-combinator circuit in front of it that generates an "erase" signal, and then you have a normal general purpose register that will accept any input, much like what piriform posted on the previous page on this thread, but without the caveats...
factorio-write-once-register.png
factorio-write-once-register.png (8.7 KiB) Viewed 15823 times

Re: Combinator Contraptions

Posted: Fri Jun 24, 2016 12:13 pm
by kann_
Guu wrote:circuit that can filter out a predetermined signal or signals from the total flux
I use this version: it is almost identical, but I wanted to try this yED software. ;)

One should add that it can only works on positive signals.
image of circuit

Re: Combinator Contraptions

Posted: Fri Jun 24, 2016 5:30 pm
by piriform
much like what piriform posted on the previous page on this thread, but without the caveats...
I like write once register design and can see uses for it, but I think that the two are different in use and operation.
I believe that the write once register performs destructive (sic?) update, i.e. the old values are erased and the new signal values are then stored. The "cheap" register does not erase the old values, instead it updates them. Thus writes of say: S1 then S2 S3 then S4 etc.. are possible.
ps. Good to see activity in this thread. Kudos to Dr. Walrus for getting it started

Re: Combinator Contraptions

Posted: Fri Jun 24, 2016 5:39 pm
by siggboy
piriform wrote:Good to see activity in this thread. Kudos to Dr. Walrus for getting it started
There could be even more. There should be a library of these things so it would be easier to learn how to make complicated designs.

The wizards like DaveMcW and XKnight and so on mostly post complete and complicated circuits but don't talk about the little tricks they employed to make it work (the digit display is a good example).

BTW you're right about the register designs, in your register it's possible to hold several signals and update them. I never had a general purpose register in mind when I made my write-once register, it's specifically to accept polling responses without troubles.

Re: Combinator Contraptions

Posted: Fri Jun 24, 2016 8:53 pm
by DemiPixel
Are there any designs for arrays in Factorio? i.e. I have a memory cell with:

- 3 transport belt
- 44 fast transport belt
- 89 express transport belt

If I have 1 blue, I get 3 green
If I have 2 blue, I get 44 green
If I have 3 blue, I get 89 green

Also perhaps the ability to set based off a num as oppose to an item?

It's easy to convert blue to an index (with a decider `blue=each out each` with a constant: 1 tp, 2 fast tp, 3 express tp`)
DaveMcW had a design for READING from the item type to the value (like two pages ago), but his has a limit on 999. Is there anyway to allow all 32 bits without any limitations? I think it might be possible to do this with only-positive but I don't really wanna go that route.

Re: Combinator Contraptions

Posted: Fri Jun 24, 2016 10:39 pm
by AccidentalChef
DemiPixel wrote:Are there any designs for arrays in Factorio? i.e. I have a memory cell with:

- 3 transport belt
- 44 fast transport belt
- 89 express transport belt

If I have 1 blue, I get 3 green
If I have 2 blue, I get 44 green
If I have 3 blue, I get 89 green

Also perhaps the ability to set based off a num as oppose to an item?

It's easy to convert blue to an index (with a decider `blue=each out each` with a constant: 1 tp, 2 fast tp, 3 express tp`)
DaveMcW had a design for READING from the item type to the value (like two pages ago), but his has a limit on 999. Is there anyway to allow all 32 bits without any limitations? I think it might be possible to do this with only-positive but I don't really wanna go that route.
I don't have a way to use the full 32 bits but it seems like you could get 31 bits and still have positive and negative values with a little extra work. The array I've actually implemented could store 30 bits but only positive numbers. To read from an index in the array, send 1G (2^30) on that index's signal, do an each > 1G on that signal combined with the array's contents, then each - 1G to restore the value. For the array to handle from -1G + 1 to 1G - 1 (basically 31 bits) you could subtract 1G from the input and store that value in the range from -2G to -1. Add -2G on the index's signal, each > 0, subtract 1G and you have your initial value.

If you really, truly have to have all 32 bits, the only way I can think of right now would be to use 2 combinators, one to store positive values and one to store negative values. then, to read, send -2G down the index's signal, each > 0 for the negative combinator and each < 0 for the positive one, add -2G, and you have the value. I haven't built this in game, but I think it should work except for storing the value -2G itself.

Re: Combinator Contraptions

Posted: Sat Jun 25, 2016 6:14 pm
by DemiPixel
What's the best way to do an int OR? Here's what I've got so far:

Code: Select all

H4sIAAAAAAAA/92X4W6bOhiGb6Xi5xkcYWPAUcek7TamKXLASayBjYzpGqHc+zEJEHoSHExaTduftqnt1/5e3u/BycRTLlKSP62ThnLFFKNV0jScFDRxMpqy
jEovFcWGcaKEdNxSVHqS4EnzmnjQPegf/4ZHNxWc07Qd0Mu/O8D5kTSSZlrqpHpYsywJ3ZTJtGaq/QCPx6P73YG3JsL/TzzpZ6yT746VNFsmK7Wu2I6TPGnU
odRnfmFS1SR33HMJ50GPknTvnFQqRbhKfP1nURLZ1pQ4nx1X1KqsLbXKwzoVNVfrrRTFmnEtkDhbklfUaY8810RgZSKaayJ4O9EdDQXjIfCX++sP9mZMnt1t
TZxh9VUMp6yO391Pwg9qz/hu2tMvdp6+UDlSnOcskUztC6pYeie8/iICgDeZXM3lwbW/l3MuiGxFW6lZK77p6aKk+gG01Tv/LEi1pbvQyl007S7w55Li99n7
9V3tvYcFu+DG0zAFwGAt/oNJq2RtiwN/MNWWtcFc1kYfGNbBVA8CFCMcRAiPI/npwzveruEj8z3pvb2Ix154E14wRYtecUMqXauShFelkMrb0Fy9caTfxPx+
gYvw126zZbmisr3QGg5ZS645wXhFpZ58Kl23QgIC4MfQZTyjryea3qvzSgFG2jrUKUCjQi74ztsTPTO71gkhghh3OoFRZ0sqdaMUH+EwjjoFZFSoCiJvSEB/
FYOwtyM0SuyIosNCBFYo8HsXIvPeSnDq/SJ5PizHAcaR3xcf31kuCdvtlad/XRRAFMcxBH312CiR1vJFP4I3AkEQhggFfe0r84PUz9ArGL8YEMXA1zX0Dug3
sWl9WwL3tBHlKIgIAl1CbwIwh7E9u3ceHiURoyBEYW8CuJNGsrmEL4hw7K/A0AnmAEqR/qRK75+LUfziIEYAw8EDcwTTPS2Y/k7qldpNdSniwuROJrRCCZyP
knA+SqbvMl3xaBIh07fMLngDOizK9OdXeeNV+hAwowBPFzuDlxis4OO0RP4qeoCV0B/ytQiUwB9ibkHJcOgva0LCoasX0XHAij0YB6bZInFg6QIYRsspiO3p
h5ZTDz4EOzBm3NFl6amRm+6frulCqbfrmsid/CqkNZ8lVbqTn9bPlGf/AatE/uEHFAAA
4 combinators to convert binary in separate items (2 for each int)
1 cominator to OR
3 combinators to map each item back to their number and add together

Ideally if you know a better way to do this, I'd like a hint instead of an answer ;) (unless it's really not intuitive).

Re: Combinator Contraptions

Posted: Sat Jun 25, 2016 11:06 pm
by DaveMcW
That looks about right. The only optmization I can think of would be to use 32 deciders to perform it in 2 ticks.

Re: Combinator Contraptions

Posted: Sun Jun 26, 2016 1:34 pm
by Jupiter
I've made a 24-h clock. I suppose it's one of the simpler contraptions posted in this thread but there weren't any clocks so I made one. It uses the smart display mod to show the values.

Screenshot
The constant comb. and decider comb. to the left form the basis of the clock. They increase the A signal by 1 every tick.
The rest of the arithmetic combinators just compute the number of seconds or minutes or w/e and calculate the remainder (1000800 ticks = 278 minutes = 4 hours and 38 minutes).

Re: Combinator Contraptions

Posted: Sun Jun 26, 2016 5:36 pm
by XKnight
DemiPixel wrote:What's the best way to do an int OR? Here's what I've got so far:

4 combinators to convert binary in separate items (2 for each int)
1 cominator to OR
3 combinators to map each item back to their number and add together

Ideally if you know a better way to do this, I'd like a hint instead of an answer ;) (unless it's really not intuitive).
As far as I remember there should be 6 combinators at all.

Re: Combinator Contraptions

Posted: Mon Jun 27, 2016 7:31 pm
by DemiPixel
Not many combinator changes, just a few virtuals and asthetics it looks like. The circuit network as a whole got some pretty awesome things, so I think we're gonna see more "interactive" stuff than just "tetris" and "game of life" builds!

Re: Combinator Contraptions

Posted: Mon Jun 27, 2016 8:12 pm
by siggboy
DemiPixel wrote:Not many combinator changes, just a few virtuals and asthetics it looks like.
The decider combinator got changed, and this will help in many cases (and break a few contraptions).

Re: Combinator Contraptions

Posted: Mon Jun 27, 2016 8:38 pm
by DemiPixel
siggboy wrote:
DemiPixel wrote:Not many combinator changes, just a few virtuals and asthetics it looks like.
The decider combinator got changed, and this will help in many cases (and break a few contraptions).
This is true, we'll have to see if anything comes of that small change.

Re: Combinator Contraptions

Posted: Mon Jun 27, 2016 8:56 pm
by Dr. Walrus
siggboy wrote:
DemiPixel wrote:Not many combinator changes, just a few virtuals and asthetics it looks like.
The decider combinator got changed, and this will help in many cases (and break a few contraptions).
I know the variable signal delayer I had on the first page relied on using the old input count option of the decider combinator. I had wanted to redo it anyways, so I built a new version last night that doesn't rely on the old way decider combinators worked. Just from thinking about it, the change isn't going to harm too many builds (this one is totally broken) and will shrink many contraptions. For example to output only a blue signal based on a condition red = 3
you previously had to use:
{If red=3 then inputcount everything} followed by {input blue+0 output blue} which is 2 ticks
but now you can use:
{If red=3 then inputcount blue} which is 1 tick

That's the most obvious change I could think of without playing too much yet.

Re: Combinator Contraptions

Posted: Mon Jun 27, 2016 9:00 pm
by siggboy
Yes, the new behaviour is much better, and it will simplify my own builds as well in a few places. Just yesterday I've postponed working on a circuit when I realized I could save a combinator each in three different places with the 0.13 decider.

Re: Combinator Contraptions

Posted: Tue Jun 28, 2016 6:13 am
by DemiPixel
I made a contraption that will simulate throughput from an outpost or external belt at your base.

https://www.youtube.com/watch?v=vk_aDAO8qQ4

Basically I have a 30 tick clock. I declare that pulses are the same as output (which makes sense if you think about it). This means however many pules are in that 30 tick cycle are the number of inserters that fire to remove from the belt at your base (the simulated output).

pulse : count (pulse is relative to count if input=output) because:

pulse = item/tick
count = item/belt

1) item/tick : item/belt
2) item : item * tick/belt
3) 1 : tick / belt

Belt speed is tiles/sec. For express belt, this is 5.625 tiles/sec (taken from here)
Convert this to tiles/tick which is the same as belt/tick: 0.9375 belt/tick
Reciprocal will give us tick/belt which in this case is 10.6666...

This means the ratio of pulse : count is 1 : 10.6666 which means to get the same "units" as pulse, we divide count by 10.666. In the video I do / 10 but I should have rounded to 11.

Re: Combinator Contraptions

Posted: Fri Jul 08, 2016 11:07 am
by siggboy
It is not related to Factorio, but I think there could not be a better place than this thread to share this:

https://www.youtube.com/watch?v=z71h9XZbAWY

(It's obviously not me in that video, that's somebody else, I'm just sharing the link :) )

Re: Combinator Contraptions

Posted: Fri Jul 08, 2016 7:08 pm
by piriform
It is not related to Factorio, but I think there could not be a better place than this thread to share this:
But , but.. It's so small!. I want one :D

Re: Combinator Contraptions

Posted: Fri Jul 08, 2016 7:10 pm
by Amegatron
siggboy wrote:It is not related to Factorio, but I think there could not be a better place than this thread to share this:

https://www.youtube.com/watch?v=z71h9XZbAWY

(It's obviously not me in that video, that's somebody else, I'm just sharing the link :) )
At last I've got what transistor does :)