Hi again!
So my base is growing and new question appears.
I'm an engineer in life but it's a shame to admit - I'm stupid in factorio circuit network logic.
I cannot get how game ticks influence logic circuits that I design,
Maybe you can help me.
So, I have a chest that is filled with something like the following (one number - one, let's say, second, let's call this chest "C")
And below is what I need my memory to display (let's call it "Z"):
C: 0-1-0-0-0-0-2-2-1-1-0-0-0-0-0-3-3-2-1-0-0-0...
Z: 0-1-1-1-1-1-2-2-2-2-2-2-2-2-2-3-3-3-3-3-3-3...
I hope you got it. Will be glad to the complete solution.
But if you are interested, here is how I do it, maybe you can just correct me.
This is my solution:
Combinators are following:
My logic is the following:
Z - resulting variable, A - temporary.
Decider combinator sends 1 in case input signal is larger that Z
Arithmetic combinator than adds this 1 to resulting signal.
If it's not enough and input decider signal is still larger than Z, decider still sends 1,
And arithmetic combinator adds 1 again,
After signals get equal or input becomes less, decider combinator sends nothing, so arithmetic combinator just adds 0 constantly, keeping Z constant.
But what I'm getting is following:
C: 0-1-0-0-2-1-0-0-3-3-2-2-1-1-0-0-0-4-3-2-1-0-0-0...
Z: 0-2-2-2-2-2-2-2-4-4-4-4-4-4-4-4-4-6-6-6-6-6-6-6...
I just don't know what's wrong here...
Circuit net: help with saving max value in a memory cell
Re: Circuit net: help with saving max value in a memory cell
The problem is your temporary variable A exists for 2 ticks before Z updates, so every increment is +2 instead of +1.
You could run A through a timer/filter, so it is only allowed to exist once per 5 ticks (the filter itself increases the lifetime of A, so you can't just use once per 2 ticks).
Or you could reset the memory cell instead of incrementing it, like this:
You could run A through a timer/filter, so it is only allowed to exist once per 5 ticks (the filter itself increases the lifetime of A, so you can't just use once per 2 ticks).
Or you could reset the memory cell instead of incrementing it, like this:
Blueprint
Re: Circuit net: help with saving max value in a memory cell
Yes, reset seems more valid option because it can have more places to apply than just increment.
I tested this and it works.
Thanks a lot!
I tested this and it works.
Thanks a lot!