There is one fox, one rabbit, and 30 carrots. The fox runs around and the rabbit runs around. When the rabbit hits a carrot, it becomes empowered for 3 seconds. When the rabbit is empowered, the fox becomes frozen. |
The game plan seems logical at first, but if you execute it, you will find
that once the fox is frozen, it will never move again, even when the rabbit
is no longer empowered. This is because we never described how a fox can
become not frozen. Thus, we would need to add a sentence, "When the rabbit is not empowered, the fox becomes unfrozen." |
There is one fox, one rabbit, and 30 carrots. The fox runs around and the rabbit runs around. When the rabbit hits a carrot, it becomes empowered for 3 seconds. When the rabbit is empowered, the fox becomes scared. When the fox is scared, it is frozen. Otherwise, the fox is not frozen. |
This is slightly more complicated example with a new problem. Again, once the fox is frozen, it will never move again. This is because nothing describes how to make the fox not scared! So once the fox becomes scared, it will be scared forever and thus, frozen forever. How would you fix the game plan? |
Now, if you wish to say 'When the rabbit touches a fox or a coyote, it dies., the compiler will automatically convert the sentence into two sentences, namely,
However, suppose you wish to follow the previous sentence with another sentence starting with 'Otherwise', it might not work correctly. For example:
One way to fix this is to separate the antecedent clauses in the first sentence. For example:
// Game #1. Avoid the bamboos, dinos, and get to the star.
// Game #2. Bone Finder: find all 7 bones without exploding 12 walls
If the fox has 3 Boolean attributes instead of 2, how many combinations will there be? If you came up with 8, you are right! Consider a true-false quiz containing 5 questions. How many different answer sheets can there be? One can answer 'true' to all the questions, all the way to another that answers 'false' to all the answers. If you enumerate all the possible combinations, there would be 32 possible answer keys.
In fact, if there are n Boolean attributes, there will be 2 to the power of n combinations. If we have 10 attributes, the number of combinations quickly grows to 1024! This is referred to as combinatorial explosion. This means that the number of combinations will grow exponentially with the number of items (attributes in this case) that we need to consider.