Page 1 of 1

Combinator counter with upper bound

Posted: Fri May 24, 2019 9:25 pm
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?

Re: Combinator counter with upper bound

Posted: Fri May 24, 2019 10:21 pm
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)

Re: Combinator counter with upper bound

Posted: Sat May 25, 2019 8:05 pm
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 141 times

Re: Combinator counter with upper bound

Posted: Sat May 25, 2019 8:30 pm
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.