- AND &
- OR |
- XOR ^
- Compliment ~
- RShift >>
- LShift <<
- Bit Select
Boolean Combinators
Moderator: ickputzdirwech
Boolean Combinators
Can we get some Boolean combinators so we can compute things with without having to split each bit out. Alternately exposing it as a modding api in some way.
-
- Fast Inserter
- Posts: 185
- Joined: Sat Apr 11, 2015 7:52 pm
- Contact:
Re: Boolean Combinators
I think you could at least try to build these out of the combinators you have.
At least AND, OR and XOR I could imagine won't be a problem.
...I don't know wht the others are.
At least AND, OR and XOR I could imagine won't be a problem.
...I don't know wht the others are.
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Boolean Combinators
Bitwise they are a problem:deepdriller wrote:I think you could at least try to build these out of the combinators you have.
At least AND, OR and XOR I could imagine won't be a problem.
...I don't know wht the others are.
5 ^ 3 = 6
5 & 3 = 1
5 | 3 = 7
compliment is easy: just add 1 and multiply with -1
Re: Boolean Combinators
Think of each signal, as it is one cable of a bus.
And 8-bit bus has 8 signals in Factorio.
Maybe the wiki can also help to understand the concept: https://forums.factorio.com/wiki/inde ... /Smart_bus
And 8-bit bus has 8 signals in Factorio.
Maybe the wiki can also help to understand the concept: https://forums.factorio.com/wiki/inde ... /Smart_bus
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Boolean Combinators
The problem is not that they can not be built, I am doing so for my CPU. The problem exists that it is not an efficient use of game resources. I could easily implement it by splitting out all the bits but in doing so would require at minimum of 31 divides and multiplies (and a < 0 for the sign bit) to get from one "input value" to 32 bits ( 3 or 4 game ticks of propagation ). Additionally it would require another 32 comparison gates to reconstruct a 32 bit value ( 1 tick or propagation ).
Currently in my design I am moving 6-10 data signals of 32 bits around so I am able to compute things at reasonable speeds. I am also going to want these features if I am ever going to get a floating point computation to work without hundreds or more gates.
As it stands my memory system is already at ~3100 gates for around 24KB of memory and I am aiming for a 1MB.
Currently in my design I am moving 6-10 data signals of 32 bits around so I am able to compute things at reasonable speeds. I am also going to want these features if I am ever going to get a floating point computation to work without hundreds or more gates.
As it stands my memory system is already at ~3100 gates for around 24KB of memory and I am aiming for a 1MB.
Re: Boolean Combinators
Hm. I see what you want to achieve.
But isn't that useless? I mean: That is exactly how a computer works. What sense would it make to create a computer in Factorio, which implements the same kind of logic as a computer mainboard, or a computer program?
This is is not, how a Factorio Computer would work. It is not a 32-bit computer. That thing works with signals. We have here a (graphically designed) DSP (https://en.wikipedia.org/wiki/Digital_signal_processor).
In other words: You need to do things differently, to achieve the same. In my eyes it is the future of computing: Mainboards gonna be connected via fibreglass.
http://www.opencompute.org/blog/introdu ... open-rack/
http://www.opencompute.org/projects/open-rack/
http://www.opencompute.org/blog/author/frankovsky
German: http://www.golem.de/news/group-hug-und- ... 96970.html
Signals are bundled together into one cable. The good question is: How will future computers work with that kind of logic?
This is interesting. Rebuilding current design is not (that's what mods are for: solving computation problems in a language, that is known). My opinion. Try to convince me: Why would it be useful to have the same type of logic as everyone uses in Factorio? Just to rebuild existing logic in Factorio? To make your "job" as gamer, that wants to rebuild a computer easier? Is that a good game-value?
(I mean, the right way would be to implement that as mod first. But I think this is not modable now?)
But isn't that useless? I mean: That is exactly how a computer works. What sense would it make to create a computer in Factorio, which implements the same kind of logic as a computer mainboard, or a computer program?
This is is not, how a Factorio Computer would work. It is not a 32-bit computer. That thing works with signals. We have here a (graphically designed) DSP (https://en.wikipedia.org/wiki/Digital_signal_processor).
In other words: You need to do things differently, to achieve the same. In my eyes it is the future of computing: Mainboards gonna be connected via fibreglass.
http://www.opencompute.org/blog/introdu ... open-rack/
http://www.opencompute.org/projects/open-rack/
http://www.opencompute.org/blog/author/frankovsky
German: http://www.golem.de/news/group-hug-und- ... 96970.html
Signals are bundled together into one cable. The good question is: How will future computers work with that kind of logic?
This is interesting. Rebuilding current design is not (that's what mods are for: solving computation problems in a language, that is known). My opinion. Try to convince me: Why would it be useful to have the same type of logic as everyone uses in Factorio? Just to rebuild existing logic in Factorio? To make your "job" as gamer, that wants to rebuild a computer easier? Is that a good game-value?
(I mean, the right way would be to implement that as mod first. But I think this is not modable now?)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Boolean Combinators
I will only be talking about AND, OR, and XOR. Shifts, compliment, and bit selection are nice but can be done using existing methods.
I say that these mathematical atoms are necessary. Giving users access to these you enable them to develop new ways of thinking and If you want to build a system why limit the user to adding and subtracting.
Masking values to get data is an important part of current day computing. There is no computer today that exists without these principles. It is worth letting the users ask why is this here and leading them on a path of discovery to that of computing; Factorio is more then just a simulation/game it is a teaching tool. One example of such is the ethical debate about invading another planet and exploiting the natural inhabitants.
There are all kinds of tricks that you can use as a programmer ( or hardware designer ) that uses these operations. https://graphics.stanford.edu/~seander/bithacks.html
Digital signal processing is an interesting mention because factorio is very much a digital system to process. The difference between what I am seeing on the forums ( for the most part ) and what I want to do is build feedback loops in my system. My system would have memory of past events and be able to use that data to adjust my productions. Calculating a FFT is easy using a DSP ( I have done this in school ) in factorio not so much . So I would argue that factorio is not a DSP but could be setup like one with correct implementation.
If for instance I am counting the number of Iron plates used and produced I can calculate a difference easily. If I wanted to build a PID controller to calculate how much I should adjust my rate of smelting by would require much more math. I am not sure it is possible with the current implementation.
With the ability to use these atoms I would be able to build any system, not just what you envision the game to be. I would like to take this as far as I can to see if it is possible to build a factory that every action is centrally controlled.
I am also not a factorio modder ( so I could have easily missed it ) but I did look over the /data folder and did not see any way to change the behavior of ( or amend ) the current system of combinators.
I also don't see how what you linked ( although very awesome ) applies here. They are all still clock based systems that don't "flow" data but instead process it one instruction at a time.
Just an FYI: You make a very good argument and it took me over an hour to write up this post.
I say that these mathematical atoms are necessary. Giving users access to these you enable them to develop new ways of thinking and If you want to build a system why limit the user to adding and subtracting.
Masking values to get data is an important part of current day computing. There is no computer today that exists without these principles. It is worth letting the users ask why is this here and leading them on a path of discovery to that of computing; Factorio is more then just a simulation/game it is a teaching tool. One example of such is the ethical debate about invading another planet and exploiting the natural inhabitants.
There are all kinds of tricks that you can use as a programmer ( or hardware designer ) that uses these operations. https://graphics.stanford.edu/~seander/bithacks.html
Digital signal processing is an interesting mention because factorio is very much a digital system to process. The difference between what I am seeing on the forums ( for the most part ) and what I want to do is build feedback loops in my system. My system would have memory of past events and be able to use that data to adjust my productions. Calculating a FFT is easy using a DSP ( I have done this in school ) in factorio not so much . So I would argue that factorio is not a DSP but could be setup like one with correct implementation.
If for instance I am counting the number of Iron plates used and produced I can calculate a difference easily. If I wanted to build a PID controller to calculate how much I should adjust my rate of smelting by would require much more math. I am not sure it is possible with the current implementation.
With the ability to use these atoms I would be able to build any system, not just what you envision the game to be. I would like to take this as far as I can to see if it is possible to build a factory that every action is centrally controlled.
I am also not a factorio modder ( so I could have easily missed it ) but I did look over the /data folder and did not see any way to change the behavior of ( or amend ) the current system of combinators.
I also don't see how what you linked ( although very awesome ) applies here. They are all still clock based systems that don't "flow" data but instead process it one instruction at a time.
Just an FYI: You make a very good argument and it took me over an hour to write up this post.
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Boolean Combinators
PID should be doable considering each combinator induces a tick of lag.
The integral is simple enough just adapt a clock to take the input instead of a constant 1. The loopback can be scaled to do exponential decay of the I or use a long line of combinators to delay the signal.
The derivative requires a single combinator to delay the signal and then use a subtracting combinator.
Then it's 3 multiplies for the parameters and a sum to export the signal to the inserters
The integral is simple enough just adapt a clock to take the input instead of a constant 1. The loopback can be scaled to do exponential decay of the I or use a long line of combinators to delay the signal.
The derivative requires a single combinator to delay the signal and then use a subtracting combinator.
Then it's 3 multiplies for the parameters and a sum to export the signal to the inserters
Re: Boolean Combinators
Ok, the argument with the teaching tool convinced me.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
-
- Filter Inserter
- Posts: 778
- Joined: Sun Sep 07, 2014 12:59 pm
- Contact:
Re: Boolean Combinators
This idea gets my vote too
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.
Re: Boolean Combinators
I'm not sure if you've seen some of the posts in this forum but bit splitting is much easier (and cheaper) than this. To get 31 'clean' bits you need 3 constants, 1 arithmetic and 1 decider. If you can tolerate 'dirty' bits you can omit the decider.Going back takes about 6 combinators. AND,OR,NOT,XOR requires a decider for each (and 3 constants for NOT).I could easily implement it by splitting out all the bits but in doing so would require at minimum of 31 divides and multiplies (and a < 0 for the sign bit) to get from one "input value" to 32 bits ( 3 or 4 game ticks of propagation ). Additionally it would require another 32 comparison gates to reconstruct a 32 bit value ( 1 tick or propagation ).
If you don't need full 32 bits and can live with 31 this is certainly a viable approach.
As a general comment, bit splitting is very situational (in Factorio world). Yes, there are uses for it, but in many cases one would be better off in fully exploiting existing functionality. What I mean by that is that you could design a fully functional 8,16,31 bit computer that could add, subtract, multiply etc. and if that's your thing, then go for it. But if you are trying to solve a problem this approach is er.. less than optimal.
-
- Filter Inserter
- Posts: 549
- Joined: Fri Jan 29, 2016 2:48 am
- Contact:
Re: Boolean Combinators
Upon reflection, think this question of computer logic vs. combinators is interesting and surprisingly rich.
The factorio-cosmos is not the same as the meat-cosmos, obviously, even if the latter is a model for the former in the imagination of the Factorian gods.
In the factorio-cosmos, red and green wires (but not other types of wire) somehow broadcast the bundles of signals we associate with combinators. The obvious metaphor to meatspace is: a network of interconnected meatspace wires is a bus for a single time-varying bit of information, whereas a network of interconnected factorian red or green wire is a bus for a constant-combinator-style bundle of time-varying measures of in-game objects and virtual signals.
But, we might propose an alternative way to think about it. Perhaps the "constant-combinator" bundles of information are in many contexts more usefully considered to be analogous to the meatspace EE concept of a wire's instantaneous electrical potential to ground, expressed as a time-varying, potentially negative, discrete number of electron-volts.
... hmmm ....
tldr: I suspect in that framework we decide that combinators are more analogous to transistors than logic gates, and we end up deciding it is, after all, useful to build boolean computers in the factorian cosmos (but maybe still not in the actual game due to the computational cost of simulating our computers).
This, in turn, does suggest there almost certainly is meatspace-utility in creating higher-level in-game computer-brain object types, perhaps being somewhat analogous to FPGAs.
The factorio-cosmos is not the same as the meat-cosmos, obviously, even if the latter is a model for the former in the imagination of the Factorian gods.
In the factorio-cosmos, red and green wires (but not other types of wire) somehow broadcast the bundles of signals we associate with combinators. The obvious metaphor to meatspace is: a network of interconnected meatspace wires is a bus for a single time-varying bit of information, whereas a network of interconnected factorian red or green wire is a bus for a constant-combinator-style bundle of time-varying measures of in-game objects and virtual signals.
But, we might propose an alternative way to think about it. Perhaps the "constant-combinator" bundles of information are in many contexts more usefully considered to be analogous to the meatspace EE concept of a wire's instantaneous electrical potential to ground, expressed as a time-varying, potentially negative, discrete number of electron-volts.
... hmmm ....
tldr: I suspect in that framework we decide that combinators are more analogous to transistors than logic gates, and we end up deciding it is, after all, useful to build boolean computers in the factorian cosmos (but maybe still not in the actual game due to the computational cost of simulating our computers).
This, in turn, does suggest there almost certainly is meatspace-utility in creating higher-level in-game computer-brain object types, perhaps being somewhat analogous to FPGAs.
Re: Boolean Combinators
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
-
- Filter Inserter
- Posts: 549
- Joined: Fri Jan 29, 2016 2:48 am
- Contact:
Re: Boolean Combinators
Yeah, that's a fairly accurate flow-chart of my argument.ssilk wrote:
As an aside, this appears to have been sculpted from the storied plate of the myth of Bob known as "gold" which was forged from a matching mythical ore. Of course there is no such thing in real life, but if I recall my mythology correctly, even wire spun from the hyper-conductive golden plate was not believed by Bob to conduct red-and-green wire signals.
Re: Boolean Combinators
It was more the glassy eyes of this small figure that fascinated me and I felt that matches that post as answer perfectly.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...