Foundations
Truth Tables
A way to write down every case a question can have, so you can see that two different-looking tests are the same test.
Begin — Unit 01 →What this is
A condition such as alive AND (ammo > 0) joins two Boolean answers: is the
player alive, and is there ammunition? AND requires both to be true.
Asking Two Things at Once explains joined
conditions if you want that introduction.
This is the other half. Not how to write a test, but how to know what it does: all of it, for each combination of Boolean input values.
The instrument is a truth table. It is a small grid that lists every combination the inputs can be in and what comes out of each one. Because it lists every combination, it lets you check every Boolean row. You still need to check that the inputs represent the game facts you intended and that the target language evaluates them as expected.
Who it’s for
Anyone whose IF has grown a second condition, then a third, and has stopped being sure
what it does.
That happens quickly. A guard like “let them jump if the button is down and they are on the ground and they are not stunned” is three conditions with two words joining them, and the difference between what you wrote and what you meant is not visible by staring.
You need no binary notation or machine for this. The Boolean reasoning transfers; a language’s numeric representation and evaluation rules need their own check.
What it is not
The units briefly recall AND, OR and NOT; prior attendance is not required.
Nor does it teach circuits. That comes later, in Gates and the Adder, once you have met binary and there is something worth building.
The shape
- True and false — a question has two answers, and a table lists them all.
NOTturns one round. - Both, either, different —
AND,ORand the one you have not met, which asks whether two things differ. - Two guards, one guard — proving that a tangled test and a plain one are the same test, and swapping the tangled one out.
Nothing here gates anything. It is a side-path, and a short one. Take it when your conditions start getting away from you.