Combinator Incrementer/Decrementer
-
- Burner Inserter
- Posts: 6
- Joined: Wed Nov 26, 2014 9:47 am
- Contact:
Combinator Incrementer/Decrementer
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.
-
- Filter Inserter
- Posts: 280
- Joined: Wed Mar 02, 2016 10:09 pm
- Contact:
Re: Combinator Incrementer/Decrementer
This could be used in a frequency counter. IE, iron belts per minute on a belt.
Re: Combinator Incrementer/Decrementer
Nice! Now see if you can do it with 3 combinators.
-
- Burner Inserter
- Posts: 6
- Joined: Wed Nov 26, 2014 9:47 am
- Contact:
Re: Combinator Incrementer/Decrementer
I concede how do I do it with 3 combinators?
Re: Combinator Incrementer/Decrementer
This is one solution.
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 ). 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.
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 ). 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.
-
- Burner Inserter
- Posts: 6
- Joined: Wed Nov 26, 2014 9:47 am
- Contact:
Re: Combinator Incrementer/Decrementer
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.
-
- Burner Inserter
- Posts: 6
- Joined: Wed Nov 26, 2014 9:47 am
- Contact:
Re: Combinator Incrementer/Decrementer
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.
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.
The catch is that the value provided is offset such that 4 becomes -5, 8 becomes -9 and so on.
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.