Logic Puzzles
These puzzles provide conditional expressions to perform different computations or actions depending on whether a condition is met.
Contents
Puzzles Reference
if / else
With these puzzles, you can implement branching (control flow) in your puzzles.
Suppose, you got a cube and a sphere in your scene. When the user clicks on the sphere, you want to hide it, but only if the user has clicked on the cube before. Such a scenario can easily be implemented with a variable for remembering if the cube has ever been clicked:
Sometimes you need to compare a variable with multiple values, and thus need more branches. In this case, you can expand the if puzzle by clicking on the gear icon and dragging out more slots: elseif or else.
As a result, you'll be able to fill up the newly created slots with any actions you want to happen in your scenario:
comparison
This puzzle compares two values and outputs a logical value as the result of comparison.
Instead of explicitely using the true / false values as in the example above, you can leverage any other puzzles such as text to set a value for a variable. In this case, however, you will additionally need the comparison puzzle to be able to check textual values. The result of comparison (true or false) is then supplied to the if / else puzzle:
Here is a more advanced example: hide the sphere only if the user clicked on the cube 3 times:
logical operators AND / OR
You can further detail your comparisons by using the logical AND / OR operators.
Example:
logical operator NOT
You can negate the result of a logical expression (convert true to false and back) by using the logical operator NOT.
Example:
true / false
The logic puzzles operate with only two values, true and false, also known as Boolean values.
These values are returned as output by the comparison puzzle, as well as by the logical operators AND / OR and NOT, and supplied as inputs to the branching puzzles if / else and test.
null
The null value, strictly speaking, is not related to logical algebra. If a variable is set to null, it means it is not set to true or false, but rather left "undecided".
You can use null to explicitely initialize a newly created variable.
test
Sometimes you can make your puzzles a bit more compact or more convient to use by leveraging the test puzzle which returns value right away.
Example:
Having Troubles with Puzzles?
Seek help on the forums!