Trailmakers

Trailmakers

AND gate is really an XOR gate :(
while both inputs red+green are active they should make an output of 1.
however the red acts as negative. this is not how AND gates should work. make both inputs positive so when you press both they don't cancel each-other out.
either fix AND gate to be 2 inputs = output or let us change the value of both inputs so theyre not a XOR gate function
< >
1-5 van 5 reacties weergegeven
with red+green inputs it shouldn't output 1, because 1+(-1)=0. They are working as intended. Since both keybinds act as the same input, making them both positive wouldn't work either because then it would behave like an OR gate. Making both of them positive is also not possible because it would force blocks which can be activated in 2 directions (such as mechanical blocks or engines) to use logic for one of the directions, making that basic function more convoluted and breaking most creations. If you want an AND gate activated with 2 keybinds, simply put one of those keybinds on a separate gate
Laatst bewerkt door alvaroping1; 5 jun 2022 om 14:41
ok ive been messing around with it and the only way to get a true AND gate is with 3 and gates. A[red empty green Q] B[red empty and green E] C[both red and green empty]
A+B=C output this shouldnt require 3 and gates to make one real and gate
Laatst bewerkt door ☼king wu; 5 jun 2022 om 15:13
you just need a single AND gate and another gate for the second keybind. A single AND gate is already a real AND gate as long as the sum of the inputs isn't 0
Since it's trinary and not binary, the gates don't work the same way as classic boolean gates.

If I understand correctly, I think it's more like:

"AND" = min(1, max(-1, (A+B+(...)))) * (abs(A)*abs(B)*(...))
"OR" = min(1, max(-1, (A+B+(...))))
"XOR" = (A * ((B == 0) * (...)) + (B * ((A == 0) * (...)) + (...)

I'm not sure if there's a standard for trinary logic; but basically what the game does is a sorta jerryrigged approach using floats (or maybe fixed point decimals, I'm not sure how they handle precision since there's no way to get a numeric readout) with math operations and in the case of XOR also comparison with zero (with True producing a 1, and False producing a zero). Or something equivalent to that.
Laatst bewerkt door Poison Dart Frag; 6 jun 2022 om 9:28
Origineel geplaatst door Poison Dart Frag:
Since it's trinary and not binary, the gates don't work the same way as classic boolean gates.
they aren't trinary, they just have 2 different values: a truthness value and an output value. The output value is the main value and can be any number in the range [-1, 1], it determines the strength and direction of the signal, which blocks then use to determine how they are activated (power and direction if applicable) or the strength of its output if it's a logic gate. The truthness value is directly calculated from the output value: a 0 output value represents a False truthness value while any non 0 output value represents a True truthness value. This truthness value is what logic gates use to determine if they will send an output or not, and logic gates follow the normal boolean algebra using it. If a logic gate determines it doesn't have to send an output using the normal boolean algebra, the output value of its output is 0 (False truthness value), if it determines it does have to send an output, the value of that signal can be simply calculated for all blocks as
min(1, max(-1, sum(inputs))) * output value coefficient of the block
for logic gates, the output value coefficient is the output value set on its configuration. For non logic gate blocks, their output value coefficient is fixed at 1

Origineel geplaatst door Poison Dart Frag:
If I understand correctly, I think it's more like:

"AND" = min(1, max(-1, (A+B+(...)))) * (abs(A)*abs(B)*(...))
"OR" = min(1, max(-1, (A+B+(...))))
"XOR" = (A * ((B == 0) * (...)) + (B * ((A == 0) * (...)) + (...)
the formula for the AND gate there is wrong because the output value is never multiplied by the output value of the inputs but rather by the output value of the gate. It would be correct if you were using the normal boolean algebra, but on that case you don't need the first part as it can be removed using the rules of boolean algebra. If you want to calculate the output value the absolute value of each input in the multiplications would need to be replaced with a different than 0 comparison. Additionally, all of those formulas are missing the output value being multiplied by the output value of the gate. While with those corrections the formulas would be correct, it's easier to think about the output value and the truthness value as separate things, which allows to simplify the formula for the output value to a single one common for all blocks and use the normal boolean definitions for the truthness value


Origineel geplaatst door Poison Dart Frag:
I'm not sure if there's a standard for trinary logic; but basically what the game does is a sorta jerryrigged approach using floats (or maybe fixed point decimals, I'm not sure how they handle precision since there's no way to get a numeric readout) with math operations and in the case of XOR also comparison with zero (with True producing a 1, and False producing a zero). Or something equivalent to that.
the output value is stored as a float, however on practice over 99% of the time you won't use the extra precission values closer to 0 have, so you can think about them as fixed point decimals with 8 decimal places
Laatst bewerkt door alvaroping1; 6 jun 2022 om 12:00
< >
1-5 van 5 reacties weergegeven
Per pagina: 1530 50

Geplaatst op: 5 jun 2022 om 13:14
Aantal berichten: 5