Skip to content

Truth Table v1.0

The image of GV Truth Table

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
DirectionTopRightBottomLeft
Inputs Now= 1= 2= 3= 4
Output5
  • >0x1;<=0xA;i3>1&&i3<99:0xABC
DirectionTopRightBottomLeft
Inputs Now> 0x1≤ 0xA> 1 and < 99Any
Outputs0xABC
  • 0;0;0;0;;i2;true;>i1:10
DirectionTopRightBottomLeft
Inputs 1 Time Ago= 0= 0= 0= 0
Inputs Now= Right InputAny> Top InputAny
Outputs10
  • 0;;1;;2;;3:4::5:6::7:8
Rule GroupDirectionTopRightBottomLeft
1Inputs 3 Times Ago= 0AnyAnyAny
Inputs 2 Times Ago= 1AnyAnyAny
Inputs 1 Time Ago= 2AnyAnyAny
Inputs Now= 3AnyAnyAny
Outputs10
2Inputs Now= 5AnyAnyAny
Outputs6
3Inputs Now= 6AnyAnyAny
Outputs7
  • true;true;Min(i1,i2),Max(i1,i2):i1+i2
DirectionTopRightBottomLeft
Inputs NowAnyAny= The smallest of the Top Input and the Right Input= The largest of the Top Input and the Right Input
OutputsTop 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 is TopRightBottomLeft, and they will be called Input 1Input 2Input 3Input 4for convenience, and their values are written as i1i2i3i4 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 ruletrueneeds to be set for Input 2.
  • If an input rule starts with one of the four operators=!=><, it will automatically addi1i2i3i4at the beginning according to which input it is. Of course, you can add it manually.
  • If an input rule is nottrueand does not contain any of the operators=!not><and&&||or, it will automatically add i1=, i2=, i3=, and i4= 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 are true, 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, add0xbefore the hexadecimal number. To use binary numbers, add0bbefore 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 Sinand 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, theRountfunction with two parameters will give strange results, and it's not solved.
  • NCalc Values 9876 1.23e9 true falseand etc.
    You can usePI() E() to get Archimedes' constant π and Euler's number e in this mod.