Truth Table v1.0

An element that can determine the output for all possible combination of the inputs. It can not only output the voltage according to the specified inputs, but can also calculate the expressions stored in it. Its Ports Definition is the same as the vanilla version.
Rules Examples
The expression of rules is based on NCalc2, and the syntax is similar to Excel formulas. Please read the following examples first:
1;2;3;4:5
Direction | Top | Right | Bottom | Left |
---|---|---|---|---|
Inputs Now | = 1 | = 2 | = 3 | = 4 |
Output | 5 |
>0x1;<=0xA;i3>1&&i3<99:0xABC
Direction | Top | Right | Bottom | Left |
---|---|---|---|---|
Inputs Now | > 0x1 | ≤ 0xA | > 1 and < 99 | Any |
Outputs | 0xABC |
0;0;0;0;;i2;true;>i1:10
Direction | Top | Right | Bottom | Left |
---|---|---|---|---|
Inputs 1 Time Ago | = 0 | = 0 | = 0 | = 0 |
Inputs Now | = Right Input | Any | > Top Input | Any |
Outputs | 10 |
0;;1;;2;;3:4::5:6::7:8
Rule Group | Direction | Top | Right | Bottom | Left |
---|---|---|---|---|---|
1 | Inputs 3 Times Ago | = 0 | Any | Any | Any |
Inputs 2 Times Ago | = 1 | Any | Any | Any | |
Inputs 1 Time Ago | = 2 | Any | Any | Any | |
Inputs Now | = 3 | Any | Any | Any | |
Outputs | 10 | ||||
2 | Inputs Now | = 5 | Any | Any | Any |
Outputs | 6 | ||||
3 | Inputs Now | = 6 | Any | Any | Any |
Outputs | 7 |
true;true;Min(i1,i2),Max(i1,i2):i1+i2
Direction | Top | Right | Bottom | Left |
---|---|---|---|---|
Inputs Now | Any | Any | = The smallest of the Top Input and the Right Input | = The largest of the Top Input and the Right Input |
Outputs | Top Input + Right Input |
Detailed Usages
According to the examples above, you may have a basic understanding of the Gigavolt Truth Table usages. Here are the detailed usages:
- Four input rules are separated by semicolons (
;
). The order isTop
Right
Bottom
Left
, and they will be calledInput 1
Input 2
Input 3
Input 4
for convenience, and their values are written asi1
i2
i3
i4
in the rules. - If rules need to be set for Input 1 and 2, but Input 3 and 4 can be any value, the rules for Input 3 and 4 can be omitted. However, extra semicolons (
;
) cannot be added. - If rules need to be set for Input 1 and 3, but input 2 can be any value, the rule
true
needs to be set for Input 2. - If an input rule starts with one of the four operators
=
!=
>
<
, it will automatically addi1
i2
i3
i4
at the beginning according to which input it is. Of course, you can add it manually. - If an input rule is not
true
and does not contain any of the operators=
!
not
>
<
and
&&
||
or
, it will automatically addi1=
,i2=
,i3=
, andi4=
at the beginning according to which input it is. - Use two semicolons (
;;
) to separate time sequences. The leftmost sequence is the earliest, and the rightmost sequence is the current input. At most, the inputs from the previous 15 rounds can be obtained. - Every time an input changes, the round number increases by 1.
- Only when the calculation result of an input rule is
true
, the next input rule will be calculated, and then the next set of time sequences will be calculated. This continues until the calculation results of all rules aretrue
, and then the output set by this rule group will be output. - Use a colon (
:
) to separate input rules and output rule. The calculation result of the output rule must be a natural number (an integer >= 0). - Use two colons (
::
) to separate multiple rule groups. When the first rule group does not output, the next group of rules will be calculated until there is an output, and no further rule groups will be calculated. There can be up to 232-1 groups of rules. - If any error occurs during the process, the calculation will stop immediately and output 0 V. Details of the error can be found in the game log.
- Numbers in rules are decimal by default. To use hexadecimal numbers, add
0x
before the hexadecimal number. To use binary numbers, add0b
before the binary number. Radix point is not supported for non-decimal numbers.
⚠ WARNING
The rule is case-sensitive!
About NCalc
If you want to know more about NCalc, please read:
- NCalc Operators
= > < + - * /
and etc. - NCalc Functions
if Max Sin
and etc.
The unit of measurement related to trigonometric functions is radian. Besides the functions mentioned in the article, you can also useAtan2 Cosh Sinh Tanh
in this mod. These functions will convert numbers to double precision floating point numbers before calculating, and the calculation process will keep the decimal, finally the output will automatically remove the decimal part.
In addition, theRount
function with two parameters will give strange results, and it's not solved. - NCalc Values
9876 1.23e9 true false
and etc.
You can usePI() E()
to get Archimedes' constant π and Euler's number e in this mod.