Combinator counter with upper bound

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Britonix
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri May 24, 2019 9:15 pm
Contact:

Combinator counter with upper bound

Post by Britonix »

I am currently working on a combinator counter. Although, I want it to stop counting once it reaches a certain value, let's say 100 for this example.

Here my current setup:

Code: Select all

[ AC ] -> [ DC ]
^___________|

=AC=
Input: [T] + 1
Output: [T]

=DC=
Input: [T] < 100
Output: T (input count)
I expect the circuit to count from 0 to 100 and to stop at 100.

Although, I get that the circuit counts from 0 to 100 in a loop, resetting itself to 1 without pausing at 100.

Reading the documentation, I expected the DC to stop outputting and so pause the circuit when [T] < 100 is false, but this does not seem to be the case.

What am I getting wrong with that setup and how can I fix it?

hale42
Inserter
Inserter
Posts: 32
Joined: Tue Apr 03, 2018 6:26 am
Contact:

Re: Combinator counter with upper bound

Post by hale42 »

why it resets is when dc hits 100 then doesnt send t to ac, then ac says 0+1=1 and sends t=1 and it resets

also every signal is present on every circuit so t is there its just 0 and hidden

if you increase dc's condition to less than 101 it will hit 100 instead of stopping at 99 and resetting (it will still reset tho)

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Combinator counter with upper bound

Post by disentius »

Came up with this:
(Digital display is DaveMcW's creation)

Set the C-value in both the upper right decider combinator, constant combinator, and the bottom deciter combinator to the desired stop value.
- constant combinator off -> counter (top left DC) counts to 100
- Constant combinator on -> reset to zero

Counter with limit and reset.png
Counter with limit and reset.png (732.4 KiB) Viewed 957 times

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Combinator counter with upper bound

Post by disentius »

Better version:

With this one you only need to set the X in the constant combinator to the desired upper bound. left DC is output.
resets to zero when there is no X.


Post Reply

Return to “Gameplay Help”