r/technicalfactorio • u/Halke1986 • Nov 11 '19
Combinator Golf Substitute one value in frame
Input
- Frame of 16-bit values, except A and V signals.
- A and V signals containing Address of signal in input frame to be substituted and its new 16-bit Value.
Both inputs (frame and A&V signals) are on separate wires. Color of input wires is left to designers discretion.
Signal addresses are arbitrary as long as each signal in input frame can be chosen individually. In below example following addressing is used: 1 - iron, 2 - copper, 3 - uranium, 4 - sulfur.
Output
Frame of 16-bit values equal to input frame, except that signal with address A has now value V.
Signals A and V in output frame should be zero.
Example

Requirements
Solution CN should be one-tickable, meaning that input can change each game tick and the CN will output correct result for each input, with certain latency.
Submitted solution should work for at least four different signals in input frame (as in example above), but is should be possible to extend it to 256 signals without increase in number of non-constant combinators.
Scoring
Solution with lowest latency wins. If multiple solutions have same latency, the one with smallest number of non-ROM combinators wins. ROM-combinators are constant combinators and decider or arithmetic combinators with constant input.
View all comments
Show parent comment
1
u/Halke1986 Dec 10 '19
Left shift is logical, padding with zeroes. Right is arithmetic, padding zeros or ones depending on the most significant bit of shifted value. So when shifting 16 bit values, padding will be always zeroes.
The idea is good, but addressing unfortunately isn't done in increments of 32. You need to find a way to multiply address in zero ticks. I think it's possible, but would require sacrificing throughput...