Counter Addition

I may have accidentally bumped into the idea of adding the values of counter’s…you can find how I made this here.

Now let’s make counter addition:

  1. Place down two counters(we will call them A and B respectively). Set their target values to 0. (You can set the other settings according to your needs)
  2. Place down a trigger(we will call it C). Make it a self-recurring trigger(you can either do this with channels or wire repeaters).
  3. Make C decrement A when it is triggered, and have C increment B when triggered. Now have A deactivate C when A reaches its target value.
  4. Now add another trigger(we will call it D), and have it also be a self-recurring trigger.
  5. Have A trigger D when target reached. Have D decrement B and increment A when triggered. Have B deactivate D when target reached.

There you have it, counter addition, a memory-efficient way to perform addition. Best part: without blocks!

Finish:







Extra

If you want to store the output of your addition operation then just copy the value A to E(which is our counter to store the result). We achieve this by placing down 2 counters(one with target 2 and another with target 3) and have them update when the targets of A and B are reached.
PS: we will call these counters I(target 2) and J(target 3) respectively.

Now add counter E as well as counter F. Have F have a target of 0. Add two triggers(G and H respectively). G should trigger when I reaches their target value. Have G increment E and F, but decrement A. Have G deactivate when J reaches their target.

Have H decrement F and increment A, and have H trigger when J reaches their target. Have H deactivate when F reaches their target.

DONE!

8 Likes

I think one thing you could do is to also make a system that outputs the result into a different counter. Great job though’

5 Likes

Thanks, I’ll try that.

1 Like

I did it by using your counter-copying mechanic.

2 Likes

there is no way I can do this without crashing it but thx though :sob:

What do you mean?

1 Like