Page 1 of 1

Issues understanding combinators output

Posted: Wed Mar 25, 2020 12:20 pm
by Kratos Aurion
I designed a contraption and I dont get a combinators behavior.

Those are the four relevant ticks (if further information is needed, be free to ask):
Screenshots
Outputting P for two ticks screws my whole contraption.

I might explain what I try to accomplish, maybe it will work with your help. I'm new to combinator logics (I've read the 101 and cookbook) and I want to improve my knowledge by trial and error. I'm a junior programmer, so some more complex explanations hopefully won't be a problem.

Re: Issues understanding combinators output

Posted: Wed Mar 25, 2020 12:47 pm
by DerGraue
It's the same reason why it does not output P =1 on tick 0. Combinator output is always delayed by 1 tick. This goes for every entity.
The combintor outputs P = 1 in tick 2 because in tick 1 the condition was true.

Re: Issues understanding combinators output

Posted: Wed Mar 25, 2020 12:52 pm
by mmmPI
I am not sure about it but here are some thoughts:

In "tick 0" you have a picture where both signals X and M are equal ( to -4), yet the P signal is not yet showing any value, it's "too early".

In "tick 1", the previous state is updated, and the combinator output a value 1 for the P signal.

In "tick 2", the input value are changed.

In "tick 3" the previous state is updated and the combinator no longer output anything.

From experience sometimes dummy combinators are used to "delay" the signal so it propagate at the same update speed in various places of the contrapation , i think i recognize a case where this might be useful.

But posting a save game or even a blueprint would allow more knowledgeable person to help you more precisely, or invalidate my hypothesis :).

Re: Issues understanding combinators output

Posted: Wed Mar 25, 2020 7:26 pm
by DerGraue
maybe one more note: the tick before tick 0 either was literally the first tick, or it had some values X != M

if you have a combinator like that "(X = M) output 1 P", then it will output 1 P if there is no input, because X and M are both 0

Re: Issues understanding combinators output

Posted: Wed Mar 25, 2020 10:57 pm
by torne
It outputs for two ticks because the input conditions are set to that for two ticks - the output is just delayed by one tick compared to the input. Check your screenshots: in tick 0 and tick 1, X and M are -4, and in tick 1 and tick 2, P is 1.

If your goal is to have it produce P=1 for one tick then this combinator doesn't seem to be the problem - it's somewhere further back. You can't get a one tick duration output from a two tick duration input unless you build a circuit that's actually an edge detector.

Re: Issues understanding combinators output

Posted: Sat Mar 28, 2020 10:44 am
by Kratos Aurion
Okay, I found my mistake, torne you were right.

I have another related question, if I feed a combinator with an input it will be procceded the next tick and evaluate it's output, won't it?
What about wires, how long do they need to deliver a signal, is there also a delay?

Re: Issues understanding combinators output

Posted: Sat Mar 28, 2020 11:30 am
by disentius
Most of your questions are answered here:
https://wiki.factorio.com/Circuit_network

Re: Issues understanding combinators output

Posted: Sun Mar 29, 2020 10:46 am
by mmmPI
Kratos Aurion wrote: Sat Mar 28, 2020 10:44 am I have another related question, if I feed a combinator with an input it will be procceded the next tick and evaluate it's output, won't it?
What about wires, how long do they need to deliver a signal, is there also a delay?
You can type /editor during a game, it has a functionnality to process 1 tick at a time, might be a useful tool.

I would answer yes to your question, if you open a constant combinator that send P=1 to a arithmetic combinator that does P+1 =P , you will read P=2 the tick after the one you open the constant, not the same tick.

While if you have 2 constant combinators set to ouput P=1 both on a green wire connected to the same power pole. Then the sum will be calculated the same tick the signal is sent to the wire and you will read P=2 ," one tick before" compared to connecting them both to an arithmetic doing each+0=each and reading its output.

That would be the "dummy" combinator i mentionned earlier , it just delay the signals by 1 tick an you can chain them so you can do other operation that "takes longer" and still compare the results of the two "branch".
torne wrote: Wed Mar 25, 2020 10:57 pm You can't get a one tick duration output from a two tick duration input unless you build a circuit that's actually an edge detector.
I am no programmer, it would have required me some testing to realize this, sticking it in a part of my head :).