Page 1 of 1

Combinator Incrementer/Decrementer

Posted: Tue Apr 05, 2016 11:55 am
by BreadProduct
Image

Image

Right so short summary of what's going on is in this example:
The smart chest receives 1 iron. This triggers D to send a quick short pulse to F which increments itself by 1.
The smart chest loses 1 iron. This triggers C to send a quick short pulse that is negated by E in order to decrement F.

You can use this to do things such as keep track of how many items are being put on conveyor belts. There are other uses I am sure but this is the reason I bothered to figure this out. Hope it helps.


Anyways more complicated explanation of what's going on. Right so the arithmetic combinator only updates itself whenever a external value changes. Thus whenever it receives a new input which is fed into itself which only gets read once and thus doesn't cause a infinite loop. Allowing it to store a value inside of itself even if all inputs are removed. Input B doesn't get used at all.

So B and D are examining the value of G. Whenever G gets one additional iron, for a split second the comparison suddenly is true sending a value of 1 which gets mathed by F.

Hopes this helps.

Re: Combinator Incrementer/Decrementer

Posted: Tue Apr 05, 2016 2:57 pm
by mooklepticon
This could be used in a frequency counter. IE, iron belts per minute on a belt.

Re: Combinator Incrementer/Decrementer

Posted: Tue Apr 05, 2016 3:48 pm
by piriform
Nice! Now see if you can do it with 3 combinators.

Re: Combinator Incrementer/Decrementer

Posted: Wed Apr 06, 2016 6:04 am
by BreadProduct
I concede how do I do it with 3 combinators?

Re: Combinator Incrementer/Decrementer

Posted: Wed Apr 06, 2016 12:14 pm
by piriform
This is one solution.
incdec.jpg
incdec.jpg (13.04 KiB) Viewed 6274 times
How it works:
The two arithmetic combinators make a pulse generator or a one shot (as explained in Combinators 101). Incoming data gets passed by the combinator on the top and then 1 tick later gets negated by the one on the bottom. The effect is a single pulse having the value of difference between the old and new data.
The decider on the right is wired in a register (or latch) configuration that stores the data.
By itself this circuit is not that useful (as you could get the same answer by monitoring the chest directly :lol: ). However, if you wanted to accumulate the data (e.g. all additions or subtractions) you could insert a decider before the register to filter out the positive or negative pulses.
(i.e. each >0; each = count or each<0;each=count).

I was impressed by the originality of your solution, and hope this gives you some more ideas.

Re: Combinator Incrementer/Decrementer

Posted: Wed Apr 06, 2016 2:10 pm
by BreadProduct
If it's just that I can do it with two. Receive a input and store it. I figured that out while I was wracking my head about what I thought your challenge was.

Image

Re: Combinator Incrementer/Decrementer

Posted: Wed Apr 06, 2016 3:50 pm
by piriform
:lol:

Re: Combinator Incrementer/Decrementer

Posted: Wed Apr 06, 2016 4:24 pm
by BreadProduct
I sort of found a way to store data using just one combinator.

The catch is that the value provided is offset such that 4 becomes -5, 8 becomes -9 and so on.

Image

However it's actually being stored.

Anyways if you look closely both the green and red output is feeding back into it's own input. That and setting the addition constant to anything other than 0 ensures that it stores a value.