Logical operations on combinator networks

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Leroy_
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Apr 24, 2020 8:46 pm
Contact:

Logical operations on combinator networks

Post by Leroy_ »

TL;DR
I would like to be able to perform "AND" and "OR" operations in one combinator

What ?
Instead of having to use three decider combinators + an arithmetic combinator and 3 circuit signals to determine if there are, for example more than 2000 coal and 3000 iron in a network, I would like for the ability to use one singular combinator to perform this logical AND operation.
Image This is my current setup for performing this exact situation described.
From the image above, you can see what I'm talking about: four different combinators are used in this situation, I would like to only have to use one combinator. Perhaps this hypothetical combinator could be called a "Logical combinator", but I'm not one extremely good with naming conventions so I don't know.
Why ?
I think that this is a relatively minor quality of life improvement so that newer players (like I was) do not have to think strongly about how to perform the operation. While it's cool that there are extremely powerful tools within combinator logic, having to actually utilize the tools at that level to be able to perform simple operations is an inconvenience when designing complex train systems where you want to have trains skip stations based on item satisfaction levels.
User avatar
SupplyDepoo
Filter Inserter
Filter Inserter
Posts: 305
Joined: Sat Oct 29, 2016 8:42 pm
Contact:

Re: Logical operations on combinator networks

Post by SupplyDepoo »

Hi and welcome to the forum!

I don't understand what your fourth combinator is for. You can already do this with one combinator.

Also, you could use a constant combinator with -2000 coal and -3000 iron and feed it & your storage amount into a decider combinator with the condition "each > 0, output X:1". Then you can check if X is >=2 (in the train schedule condition for example). This way you can filter lots of predefined signals (up to 18?) with just 2 combinators and easily expand with additional constant combinators.

I would like to see more combinator types (like a max/min filter) but I don't see what your new combinator would add that isn't already easily possible.
Leroy_
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Apr 24, 2020 8:46 pm
Contact:

Re: Logical operations on combinator networks

Post by Leroy_ »

SupplyDepoo wrote: Sat Apr 25, 2020 12:35 am Hi and welcome to the forum!

I don't understand what your fourth combinator is for. You can already do this with one combinator.

Also, you could use a constant combinator with -2000 coal and -3000 iron and feed it & your storage amount into a decider combinator with the condition "each > 0, output X:1". Then you can check if X is >=2 (in the train schedule condition for example). This way you can filter lots of predefined signals (up to 18?) with just 2 combinators and easily expand with additional constant combinators.

I would like to see more combinator types (like a max/min filter) but I don't see what your new combinator would add that isn't already easily possible.
While I agree that it is "easily" possible the main thing I want is more easy to define rules for combinators, though I see now why my idea is somewhat dumb (in design terms from what is already there) because my want is in reality combining 3 combinators into one (two comparison calcs + a comparison on those two) to make beginning calculations easier, and yes your idea works as well as the idea I ended up doing but to be honest the real thing I wanted was a more "powerful" combinator just so that inventory calculations for my train system work.

I guess the one benefit my "idea" would have is that when chaining together logic would remove 1 extra combinator per logical operation when you're doing AND calculations (X>2 and Y>1 and Z>1 would take 3 combinators and not 6), but the current design still works for its intended purposes.

This post mostly came about due to my minor annoyance of not immediately seeing the correct way to do combinator logic and can be safely ignored tbh.
Koub
Global Moderator
Global Moderator
Posts: 7787
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Logical operations on combinator networks

Post by Koub »

There are quite a number of suggestions for a wide range of "I want to do more complex things with less combinators". I'm not going to merge all of them, because each suggestion is different and targeted towards quite specific needs, but overall, I'd be very surprised if the devs added any kind of combinators.

However, if space is your thing and you're OK for using mods :
https://mods.factorio.com/mod/integratedCircuitry
https://mods.factorio.com/mod/advanced-combinator
https://mods.factorio.com/mod/MathCoProcessor
or even
https://mods.factorio.com/mod/SandboxedLuaCombinator
Koub - Please consider English is not my native language.
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

I have to agree that a more "logical" combinator (system) would be a great idea. There is a lot of flexibility in the current system between the 2 vanilla logic combinators and some of the available mods, but the practical and visual logic gets easily lost with all the extra steps involved.

I've actually tried most of those mods and they all have their shortfalls

Integrated Circuitry: definitely recommend this one. It only provides a building in which to build a circuit network so it isn't taking up a bunch of space (relative to this thread) but it does some other stuff too. I have found it key in keeping things organized. Shortfall to this one is all that complex circuitry is just hidden, and you still have limited space. (I have at least one network where I needed 2 of them because of all the comparisons I needed to make which each took up 3 combinators.)

Advanced Combinator seems like it should work, but I've had trouble with it (possibly due to gui design...I'll get back to it, but temporarily gave up on it) and in my opinion (and it sounds like the OP) many of the functions are pretty standard and straight forward logic that should really be included in vanilla.

Haven't used MathCoprocessor...the functions it appears to add I haven't needed so far.

SandboxLua Combinator...you need to know some Lua and not everyone does. Some people just want to be able to play the game, not write it. I'm picking up some things here and there the more I get into using the mods, but I couldn't go write a mod yet and last time I looked at it would be hard pressed to be able to program even this mod.

In the end, I would add my vote for the OP's request and actually add 2 more aspects. It could either expand the existing combinators or be a 3rd combinator called a Comparitor maybe.

Function one would be to compare 2 signals as the OP has stated without having to use multiple combinators...it seems simple but when you get a large complex network it is easy to get lost going from the 1st "does this signal = X" decider to the next to the arithmetic combinator that then compares those results to the next comparison group, etc, etc. Having everything in one complete logic device so you can see the full logic statement (the OP's example is one I use quite a bit myself) rather than having to switch between 3 or 4 different comparitors just seems like a no brainier to me.

The first additional aspect would be to be able to compare signals on different wires, with and without the value based logic. For examples, with: "if "Iron" on the red wire>=300 and "Iron" on the green wire=0 do this" or without: "if "Iron" on the red wire is > "Iron" on the green wire do this." Again, doable in the current system, but easy to get lost because of all the switching between the comparitors that are required to do so, especially in a large circuit.

The second additional aspect, and it could be argued it is actually a bug, would be to have a true/false only based option for the And function. In the current arithmetic combinator the And operation values not only have to be positive (true), but I have found they need to be equal to each other as well. I have often run into situations where I just want the True condition to be considered and have to go add a bunch of other combinators to first evaluate if the base signals are positive and send out another signal with a value of 1 for the And function when all I should need to do is directly compare them.

All in all, the capability is there, but for what I would call the average user, the interface options to easily implement the logic functions just aren't and I would argue that it isn't something that a mod should have to pickup the slack on.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Logical operations on combinator networks

Post by ssilk »

For the first additional aspect: there are several suggestions to do things with the separate colors. I won’t list them here, because this suggestion thread is too diverse.

For the second: this is not a bug. The logical operators work on each bit of the input. As it is with any micro processor. You can compare the input with a bit mask. Removing this as you wanted would make most player using combinator logic very very sad. :)

All in all this sounds like you struggle with the signals. It takes some time and here is my tip: instead of thinking this works like micro electronics think it as a message forwarding system, or better a signal dispatcher. That spares you a lot of trouble when you find out, that each operation takes one tick and your logic breaks, because signal 1 is “faster” than signal 2. And you begin to understand how a counter works for example. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

I have to disagree with you there and would still argue the second aspect is a bug. I do understand the signals, but I guess my logic background is apparently just different. I also don't think I'm alone though. Just about all the systems I work with use the same basic logic and truth tables. (I can't think of one that doesn't.) My actual programming background comes from Crestron and AMX control systems and not computer programming languages like Lua but the basics are all there. As an example, consider the following written more or less in the language I know with a few changes to make it make better sense for this argument. (It should be close enough to Lua to get the jist at least)


Define_Device

GreenWire 1:1 //Device 1 port 1
RedWire 1:2 //Device 1 port 2


Define_Variable

Integer X
Integer Y


Define-Call

"Iron Switch"
{
*See Versions 1-3 Below*
}

Data_Event(GreenWire,Iron) //When the value of channel Iron on device/port GreenWire changes
{
Call "Iron Switch"
}

Define_Program

X = GreenWire,Iron //Constantly updates variable X with the value of Iron from device port GreenWire
Y = RedWire,Coal //Constantly updates variable Y with the value of Coal from device port RedWire


Version 1: For my way of thinking and how this language would handle things, the following would be what I'm calling a true AND operation and is all I need to set the output to 1 (or on)

IF (X > 0 && Y > 0) //or more simply and how I would actually write it ( X && Y) where X & Y are some positive value, not necessarily equal
{
Set Output (GreenWire, 1) = 1 //Sets output channel 1 on device/port GreenWire to 1/True
}

Version 2: This can easily be exapanded to the OP's scenario or even to my first added scenario of comparing a Red signal to a Green signal (and infact I have basically done both here)...same two comparison statements but with absolute values instead of just being positive...and still not equal to each other.

IF (X = 3000 && Y = 2000)//if there are 3000 Iron on the Green wire AND 2000 coal on the red wire as defined above
{
Set Output (GreenWire, 1) = 1 //Sets output channel 1 on device/port GreenWire to 1/True
}

Version 3: Factorio's AND function looks more like this however. It's actually a longer statement because it adds a 3rd conditional statement to be evaluated. It is a valid comparison, but when only given access to the first 2 statements and not the 3rd statement, not a what I would consider a true logical AND

IF (X > 0 && Y > 0 && X = Y) //X & Y are some positive value and must also be equal
{
Set Output (GreenWire, 1) = 1 //Sets output channel 1 on device/port GreenWire to 1/True
}

Doubt it is going to change your opinion, but hopefully clears up my stance some. Getting back to the OP's comments, what I just did there with a simple quick line of code ( If(X && Y) then *do this*) takes a minimum of 3 combinators and proper interconnection and you do that even 2 or 3 times (let alone some of the conditional switching I've dreamed up) and you can easily get lost with the current system...it just isn't a logical logic system. It's a micromanaged logic system where instead of looking at complete statements it focuses on micro-statements which then have to be combined to form the macro-statement.
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Logical operations on combinator networks

Post by Bilka »

What you describe in your programming language example is logical and (often represented as &&). What the combinator does is bitwise and (often represented as &). While I have never heard of Crestron and AMX control systems, a quick google finds this https://www.manualslib.com/manual/39517 ... ml?page=58, which puts the bitwise and operator in a context that you may be familiar with. I hope this makes more clear what the combinator is doing.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

Looking at it from that perspective, then no it isn't a bug but I would argue that a logical based system should and needs to be added then. There are certainly uses for bitwise, but so far in my gameplay at least (and I'd hazard a guess at many others) what I really wish was there are logical comparisons. Right now I have hundreds of "circuit networks" whose sole purpose is just to get one signal from the output of one combinator to the input of another. I guess as the lowest common denominator the current combinators make the most sense since you can make the logical statements with them, but it just seems very inefficient when a direct logical comparison would give me the same result and I could see the entire statement in one combinator GUI instead of 3. (Not only that, but AND at least is listed in the combinator as AND not BAND which from a convention standpoint would tell me it is a logical AND not a bitwise AND.)

At the risk of starting a new suggestion, perhaps at least get the values of the signals in use by the combinator displayed in the combinator's GUI...that is another thing that makes following things hard. To see the current values on the network you have to look at a different window and depending on what else is on the network, there could be a lot of other signals that aren't relevant to the action you are trying to perform. Also, as soon as you move the mouse, that window changes so there ends up being a lot more back and forth on top of already having to switch between multiple combinators.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Logical operations on combinator networks

Post by Qon »

Fitwe wrote: Sun Jul 26, 2020 10:55 am (Not only that, but AND at least is listed in the combinator as AND not BAND which from a convention standpoint would tell me it is a logical AND not a bitwise AND.)
Just because it is called BAND in some system no one here has ever heard of, except you, doesn't make your system the convention. The circuit system is a hardware simulation, bitwise is implied by it because it is what is commonly used in hardware. The circuit system in Factorio is not a Crestron AMX simulator, please remember that. It's kinda weird and bordeline rude that you say it's a bug after people who are domain experts tell you that it is the expected behaviour in the domain. Especially since you come from a background of an esoteric system that has no widespread use in this community.

It's great that you try to learn new things, welcome to something different. It can be different and correct though. And maybe a logical and is a good suggestion? But AND doesn't have to be changed to fit your experience. We come from a place where we have AND and "LAND", not BAND and AND. ;)
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

Qon wrote: Sun Jul 26, 2020 11:12 am
Fitwe wrote: Sun Jul 26, 2020 10:55 am (Not only that, but AND at least is listed in the combinator as AND not BAND which from a convention standpoint would tell me it is a logical AND not a bitwise AND.)
Just because it is called BAND in some system no one here has ever heard of, except you, doesn't make your system the convention. The circuit system is a hardware simulation, bitwise is implied by it because it is what is commonly used in hardware. The circuit system in Factorio is not a Crestron AMX simulator, please remember that. It's kinda weird and bordeline rude that you say it's a bug after people who are domain experts tell you that it is the expected behaviour in the domain. Especially since you come from a background of an esoteric system that has no widespread use in this community.

It's great that you try to learn new things, welcome to something different. It can be different and correct though. And maybe a logical and is a good suggestion? But AND doesn't have to be changed to fit your experience. We come from a place where we have AND and "LAND", not BAND and AND. ;)
It isn't just those 2 systems, they just have the closest programming language. It is all of the systems I use that I can think of that use logic operations but point taken. Probably because in my world the logical operators are typically more important than the bitwise operators they get the AND label where in your world bitwise is more important so it gets the AND label which creates confusion. Anyway, my world isn't as small as you imply, and I actually got into Factorio from another person in my world. At the end of the day I think we both make valid arguments for changing or keeping the current naming (I didn't really expect it would change), and I'll try not to take offense to your tone. It sometimes feels like I'm an outsider when people make comments like yours (and taking your comment to heart, I can see where I effectively did the same thing even though I didn't realize it because of my experiences and I apologize.) We are a community of people who love Factorio. Just because I have a different way of doing things doesn't necessarily make either way wrong, at least not in this case. I've run across several people here who I'm sure mean well, but act as though their way is the only way with a "why would you ever do it that way?" when replying to suggestions or comments rather than a polite "nice idea, but not really where I want to take this." I just try to take it in stride and enjoy the game.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Logical operations on combinator networks

Post by Qon »

Fitwe wrote: Sun Jul 26, 2020 11:47 am It isn't just those 2 systems, they just have the closest programming language. It is all of the systems I use that I can think of that use logic operations but point taken. Probably because in my world the logical operators are typically more important than the bitwise operators they get the AND label where in your world bitwise is more important so it gets the AND label which creates confusion. Anyway, my world isn't as small as you imply, and I actually got into Factorio from another person in my world.
Yes, some things vary with where you are on the spectrum, from hardware to software.
I'm also a programmer, it's just my familiarity with some hardware notions that makes it intuitive that AND is bitwise.
My message wasn't meant to imply your world was small, just that it was not the hardware domain which circuits kind of reside in, so you shouldn't apply your domain knowledge too much when it doesn't fit. :)
Fitwe wrote: Sun Jul 26, 2020 11:47 am and I'll try not to take offense to your tone. It sometimes feels like I'm an outsider when people make comments like yours (and taking your comment to heart, I can see where I effectively did the same thing even though I didn't realize it because of my experiences and I apologize.)
Good, you shouldn't take offense :) . It was necessary that you saw the hardware perspective, or communication would be impossible and you wouldn't getr anything out of the thread. Now we can go forward and explore the actual suggestion instead of getting lost in changing the wrong thing that you don't really care about. Apology accepted.
Fitwe wrote: Sun Jul 26, 2020 11:47 am We are a community of people who love Factorio. Just because I have a different way of doing things doesn't necessarily make either way wrong, at least not in this case. I've run across several people here who I'm sure mean well, but act as though their way is the only way with a "why would you ever do it that way?" when replying to suggestions or comments rather than a polite "nice idea, but not really where I want to take this." I just try to take it in stride and enjoy the game.
Yes, Factorio as a whole is more like a systems abstraction, trancending hardware and software and uniting all engineers in one game :)
I tried to show that 2nd approach with
Qon wrote: Sun Jul 26, 2020 11:12 am It's great that you try to learn new things, welcome to something different. It can be different and correct though. And maybe a logical and is a good suggestion?
So, on topic:
So how would a Logical AND actually work?
Treating positive (alternativly non-zero) as Logical True?: One combinator can't really do (X > 0 && Y > 0) by changing AND from "&" to "&&". You still need to evalute A = X > 0 in one decider and the B = Y > 0 in another. Then you can combine them in the LAND combinator with (O = A && B).
But so you haven't reduced the number of combinators. And your LAND combinator can only LAND 2 signals, which means for logical and of (X > 0 && Y > 0 && Z > 0), the logical and will have to be split up to handle A && (B && C), 2 LAND combinators to handle each occurence of &&, because combinators take 2 signals (or a signal and a constant) and do operations on those.

But we have implicit addition. So utilising that we get (A = X > 0), (A = Y > 0), (A = Z > 0) and then we check (O = A >= 3) to see if all condistions held, we can reduce it from having n - 1 "LAND" combinators (where n is amount of values we want to LAND together) to just a single one, meaning we can reduce our combinators by potentially several thousand entities in the extreme and only have the one for each signal (doing the conversion to an A signal and testing it against a constant).

So even if Logical And was implemented, would you actually use it once you get used to the advantages of needing less combinators with the tools already available? It might make the circuits a tiny bit more readable, but I think they are kind somewhat unreadable anyways and we need something else to make the information flow visible somehow, like being able to see the values without mousing over combinators.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

Qon wrote: Sun Jul 26, 2020 12:49 pm
Fitwe wrote: Sun Jul 26, 2020 11:47 am It isn't just those 2 systems, they just have the closest programming language. It is all of the systems I use that I can think of that use logic operations but point taken. Probably because in my world the logical operators are typically more important than the bitwise operators they get the AND label where in your world bitwise is more important so it gets the AND label which creates confusion. Anyway, my world isn't as small as you imply, and I actually got into Factorio from another person in my world.
Yes, some things vary with where you are on the spectrum, from hardware to software.
I'm also a programmer, it's just my familiarity with some hardware notions that makes it intuitive that AND is bitwise.
My message wasn't meant to imply your world was small, just that it was not the hardware domain which circuits kind of reside in, so you shouldn't apply your domain knowledge too much when it doesn't fit. :)
I have some (maybe not as much as you) hardware experience and from my side of things hardware AND has always been more of the logical side than the bitwise side...maybe it's a digital vs analog circuit thing. System manufacturers are usually dealing with the digital side of things and by the time I get it I'm effectively analog, turning things on or off based on a signal. Whatever...
Qon wrote: Sun Jul 26, 2020 12:49 pm
So, on topic:
So how would a Logical AND actually work?
Treating positive (alternativly non-zero) as Logical True?: One combinator can't really do (X > 0 && Y > 0) by changing AND from "&" to "&&". You still need to evalute A = X > 0 in one decider and the B = Y > 0 in another. Then you can combine them in the LAND combinator with (O = A && B).
But so you haven't reduced the number of combinators. And your LAND combinator can only LAND 2 signals, which means for logical and of (X > 0 && Y > 0 && Z > 0), the logical and will have to be split up to handle A && (B && C), 2 LAND combinators to handle each occurence of &&, because combinators take 2 signals (or a signal and a constant) and do operations on those.

But we have implicit addition. So utilising that we get (A = X > 0), (A = Y > 0), (A = Z > 0) and then we check (O = A >= 3) to see if all condistions held, we can reduce it from having n - 1 "LAND" combinators (where n is amount of values we want to LAND together) to just a single one, meaning we can reduce our combinators by potentially several thousand entities in the extreme and only have the one for each signal (doing the conversion to an A signal and testing it against a constant).

So even if Logical And was implemented, would you actually use it once you get used to the advantages of needing less combinators with the tools already available? It might make the circuits a tiny bit more readable, but I think they are kind somewhat unreadable anyways and we need something else to make the information flow visible somehow, like being able to see the values without mousing over combinators.

I think you have the right idea? At the very least, you are correct, one current combinator can't do it and therein lies the problem. What you describe IS the current way of doing it... because it is a bitwise AND I need to take X>0 in a decider combinator and turn if from any positive value to a Boolean value of 0 or 1, then do the same thing for the Y signal in a second decider combinator, and then I can take those 2 signals and run them through the bitwise AND in an arithmetic combinator...if both signals are 1, then my output is true. In a theoritcal Logic Combinator, at a base level I wouldn't care what the values of X and Y were, just that they were positive non-zero values. I don't need to convert them to Boolean values first. (Depending on how advanced the underlying truth table was, you could theoretically even make a pair of negative non-zero values output true, but I don't see that too often in actual application.) From a programming perspective, I suppose you still end up at the bitwise level for the reasons you state which is probably why bitwise is more important in your programming. I work at the UI level and from there, I don't really need to see all that though. I just care that X and Y are positive values so make my output true.

When it comes to more than 2 signals, in the current system, you're again correct that using AND you need n-1 combinators in addition to the combinators to do the boolean conversion and using additive signals you only need 1 additional. Because I tend to think in the logical realm, I just think of it as a single truth table and not the multiple comparisons that happen behind the scene.

Bottom line, it has to do with how the data is presented. If a logic combinator or series of combinators were introduced (as I'm envisioning it) I would absolutely use it, especially if they made it advanced enough to go the next step and be able to the functional equivalent of If ((X = 1000) && (y = 3000)) and not just the positive numbers we've been using so far. The whole point of a logic combinator to me and the way I think would be to bury the current bitwise based combinators that make it work in the programming and be able to concentrate instead on the on the complete, end result statement. To put it another way instead of having to go to one combinator to check the first condition, go to another combinator to check the next condition, etc., etc., I go to one combinator to check the statement as a whole and the programming does whatever it needs to behind the scenes. I'm just starting in the grand scheme of the game's history, but I have already made some networks with a crazy amount of macro steps. Each of those macro steps comprises 3 or 4 micro steps and in the current system there is no way to see all those steps at once which makes following circuit programs difficult at best. For someone like yourself who prefers to work at the bitwise level, or for a simple If X = a comparison I would still use the current combinators also.

And to wrap this reply up...series of combinators. You could do it with one combinator as they are each effectively extensions of the previous, but I see 2, potentially 3 types...

1: Standard type, compare 2 signals based on the signals being positive non-zero values
2: Compare say 4 signals based on definable signal values (it's an arbitrary number based on I usually am comparing 2 signals. 3 crops up here and there and 4+ has happened but is rare)
3: Full on custom logic table: be able to do things like "IF X = a AND Y = b, output O= c, ELSE IF X = d AND Y = e, output O = f" I know the current system can do this (can do all 3 versions), but I think about that as an entire statement. This is a fairly easy example of it I actually wouldn't have too much problem building (just maybe cursing under my breath that I can't just write that statement somewhere ;) ), but thinking about the 6 individual comparisons going on and not being able to see them all together in one GUI is difficult for me. I need to do some more playing with it, but this option could be getting into the territory of the Advanced Combinator mod. The interface needs some work if you ask me and I've had trouble using it so far as a result (I think I entered something wrong and actually managed to have it crash my game) and kinda hoping that inclusion of something like it in the base code could/would improve the user experience and stability by better integrating it.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Logical operations on combinator networks

Post by Qon »

Fitwe wrote: Sun Jul 26, 2020 2:46 pm I think you have the right idea? At the very least, you are correct, one current combinator can't do it and therein lies the problem. What you describe IS the current way of doing it... because it is a bitwise AND I need to take X>0 in a decider combinator and turn if from any positive value to a Boolean value of 0 or 1, then do the same thing for the Y signal in a second decider combinator, and then I can take those 2 signals and run them through the bitwise AND in an arithmetic combinator...if both signals are 1, then my output is true.
[...]
When it comes to more than 2 signals, in the current system, you're again correct that using AND you need n-1 combinators in addition to the combinators to do the boolean conversion and using additive signals you only need 1 additional. Because I tend to think in the logical realm, I just think of it as a single truth table and not the multiple comparisons that happen behind the scene.
Well I guess I fumbled my example a bit by having all constants 0, which means they didn't actually need to be converted. I meant to introduce other constants. LAND would work without it when all constants are 0, because converting from from a logical value of with a fixed definition to a single bit is the implicit operation in logical AND.

What I should have written was a test like (X > 200 && Y == 3000) where the implicit X > 0 for each operand that LAND does is useless, and where LAND wouldn't reduce circuitry.

As long as combinators take two operands in the GUI to make their operations then larger truth tables with more operands isn't possible.

Fitwe wrote: Sun Jul 26, 2020 2:46 pm Bottom line, it has to do with how the data is presented. If a logic combinator or series of combinators were introduced (as I'm envisioning it) I would absolutely use it, especially if they made it advanced enough to go the next step and be able to the functional equivalent of If ((X = 1000) && (y = 3000)) and not just the positive numbers we've been using so far. The whole point of a logic combinator to me and the way I think would be to bury the current bitwise based combinators that make it work in the programming and be able to concentrate instead on the on the complete, end result statement. To put it another way instead of having to go to one combinator to check the first condition, go to another combinator to check the next condition, etc., etc., I go to one combinator to check the statement as a whole and the programming does whatever it needs to behind the scenes.
[...]
For someone like yourself who prefers to work at the bitwise level, or for a simple If X = a comparison I would still use the current combinators also.
I'm more trying to argue within the paradigm of the current system than arguing against you. But I'm not saying that another paradigm would be bad for the game. It would make circuits something different and belong to a different type of design philosophy. But the current combinators are pretty unreadable so that might be a good thing anyways.

But what you are asking for is more than "and should be logical and, not bitwise". The reason that AND is bitwise is exactly because as the circuits work now the implicit (X > 0) conversion is useless when the constant you want to test againt is not 0, and makes circuits larger than what can already be done, while bitwise AND is more powerful. Well you understand that part already now.

But why stop there? I like the Lua Combinator mod. Multiple operations per combinator is required for LAND to be a useful operator, and that would already require some form of GUI update to the combinator interface. But we are starting to expand our request quite far from what we started with. I like the suggestion when taken this far, but it makes it unlikely to happen. Mods like Circuitissmo and Lua Combinator are effectivly solving this if we want it now. And for Wube to make something official out of it they would basically have to make some sort of somewhat separate circuit editor that isn't tied to combinator entities in te real world, so that we can have a more "professional" hardware design program to design our hardware with.

And taken not far enough and just introducing LAND as an operator would do nothing, as shown. Maybe having ((X = 1000) && (y = 3000)) be evaluated in a single combinator wouldn't be a massive step though, if we are limited to something like this and don't go further with it to unlimited amount of sequential computations.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Fitwe
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jul 16, 2020 8:01 pm
Contact:

Re: Logical operations on combinator networks

Post by Fitwe »

Qon wrote: Sun Jul 26, 2020 3:48 pm
But why stop there? I like the Lua Combinator mod. Multiple operations per combinator is required for LAND to be a useful operator, and that would already require some form of GUI update to the combinator interface. But we are starting to expand our request quite far from what we started with. I like the suggestion when taken this far, but it makes it unlikely to happen. Mods like Circuitissmo and Lua Combinator are effectivly solving this if we want it now. And for Wube to make something official out of it they would basically have to make some sort of somewhat separate circuit editor that isn't tied to combinator entities in te real world, so that we can have a more "professional" hardware design program to design our hardware with.
I have checked out a couple mods. Circuitissmo I went with a different mod (Integrated Circuitry). Lua Combinator may be great at doing this, but it requires knowledge of Lua. I've had enough fun with the mods so far I wouldn't mind learning it, but right now I don't know it, just want to be able to play, and haven't seen anything on that advanced level which is easy to use. (Well, it's probably easy for you as you seem to know the language, but not me. :D ) And of course Advanced Combinator I've already mentioned.
Qon wrote: Sun Jul 26, 2020 3:48 pm And taken not far enough and just introducing LAND as an operator would do nothing, as shown. Maybe having ((X = 1000) && (y = 3000)) be evaluated in a single combinator wouldn't be a massive step though, if we are limited to something like this and don't go further with it to unlimited amount of sequential computations.
Completely agree.
Post Reply

Return to “Ideas and Suggestions”