Page 1 of 1

Extend Combinators

Posted: Mon Oct 12, 2015 1:51 pm
by gheift
I am currently playing with the combinators and i miss a few operations:
  • !=, <= or >= in the decider
  • bitwise and, or, xor in the decider
  • modulo, shr, shl, bitwise and, or, xor, not, k2? operation
  • the ability to select the signal, which should be used as output
  • the ability to specify the source wire of the signal (e.g. signal A of the green wire - signal B of the red wire)
  • the ability to specify, how the wire signals are combined before the operation (e.g. red + green as it is now, red - green, green - red)
  • check each signal condition on one wire and output corresponding signal of the other wire, where condition is met
  • vector arithmetic: each signal of green wire plus, minus, … of the red wire
  • display: show input/output signal sorted by name, not by amount
  • display: show input by source wire (like on the poles)
  • display: show operation of combinator
Most of this is more or less implementable with the current combinators, but some have a huge latency.

Any comments?

Re: Extend Combinators

Posted: Wed Oct 14, 2015 10:59 am
by ssilk
What you describe is a programming language, not a game. :)

I mean, that all can be done, but I think this gets very fast very overwhelming. Anywhere between your suggestions I would say: This is not fun anymore, I switch to a programming language.

Or how a good professor in my study-time said: Use the right tools/programming language for the problem. If you know only a hammer all your problems will look like nails.

Re: Extend Combinators

Posted: Mon Oct 19, 2015 7:45 pm
by LordFedora
you don't need >= or <=, just use !(x < y) and !(x > y) :P

Re: Extend Combinators

Posted: Tue Oct 20, 2015 6:16 am
by DaveMcW
LordFedora wrote:you don't need >= or <=, just use !(x < y) and !(x > y) :P
You don't need !, <, >, AND. Just use a bunch of NAND gates.

Re: Extend Combinators

Posted: Sun Nov 01, 2015 6:55 pm
by MrDrummer
LordFedora wrote:you don't need >= or <=, just use !(x < y) and !(x > y) :P
And how would you make that with Combinators?

I personally need >= and <=, else it will double the combinators needed... >= and <= are used in basic programming languages so having this functionality in Factorio would be great.

Re: Extend Combinators

Posted: Sun Nov 08, 2015 9:30 pm
by nikow
Hmm… This is actualy in game.
https://www.youtube.com/watch?v=YUCa2lAwNsc

So, if you need more or equal, you are using or gate for this both values, so you need 3 combinators.
Not equal is easy to get using not gate.

Re: Extend Combinators

Posted: Tue Nov 10, 2015 10:46 am
by bobingabout
A bit overkill... I've seen other better ideas for extending Combinators...

EG, A grid(Similar to modular armour) where you draw a circuit in it.

Re: Extend Combinators

Posted: Tue May 09, 2017 8:54 am
by leoch
The original idea looks a bit overkill (bitwise arithmetic, shift operations), but I definitely miss a few of these:

Selecting input source: to compare "iron plates" from the green wire with "iron plates" from the red wire, currently you have to use an arithmetic combinator with a null-op (e.g. "+ 0") to change one signal from "iron plates" to the letter "I" or something.

Vector arithmetic: I've been playing with the idea of supplying a perimeter wall by train and a circuit signal telling it what it should keep in stock. I have a basic implementation using an array of roughly 30 arithmetic+comparison combinators to test whether there is enough of each item listed locally. (And this is only half of what I want to do.) But I fear that repeating this many combinators across many wall sections is going to cause major performance issues.

Yes, "vector arithmetic" is complex programming — but not so difficult. There is already an "each" operation in the game.

I would like the following:
  • To select input source: e.g. red iron plates, green iron plates or sum iron plates (the last one is what we have now, and not really necessary except for backwards compatibility).
  • Set negation arithmetic op: "each" operation which converts values > 0 to 0, and 0 to 1. (Effect on negative values isn't important.)
  • Set subtraction arithmetic op: e.g. "green set-subtract red" would result in the green value if the red value is zero, or zero if the red value is >0.
Note: we already have set-union. It's just red + green. (Currently, an arithmetic combinator with red and green inputs, "each" input and output, and a null-op like "+0".)

Examples:
  • Inserter connected to two coal chests, inputting into green, can be enabled if "green coal < red coal".
  • Constant combinator outputting a required set of items on the red wire. Roboport outputs logistic network contents on the green wire. A decider combinator has the rule "each red > each green output each, 1" to output a 1 for every item on the red wire in greater quantity than the green wire; this output is fed into a filter inserter to set its filter, and unload into a logistic chest (e.g. from a train).

Re: Extend Combinators

Posted: Tue May 09, 2017 9:12 am
by leoch
It looks like some of this was already implemented: binary AND, OR, XOR.

Also a decider combinator with "each > 0" output "each, 1" can be used to "standardise" input.

Two remaining issues:
  • We can't directly compare green and red signals, e.g. "each red - each green" or "each red < each green".
  • "Each" does not behave as I would expect, e.g. a decider combinator with "each == 0 output each" will output nothing. "Each > 0 output A, 1" can be used to count non-zero signals, but "Each == 0 output A, 1" will always output 0. As I understand it, there are a fixed set of names on the signal bus; each should be counted even if 0 on input.