Game Development Reference
always producing a 0 or negative number result, or the calculation is missing alto-
gether, then the duration will not get displayed.
The immunity duration granted by Vanish is one second at Level 1, two seconds at
Level 2, and five seconds at Level 3. This relationship can be expressed by the equation
vanishDuration = (2 << level) - level;
So at Level 1, this becomes 2 - 1 = 1. For Level 2, 4 - 2 = 2, and Level 3, 8 - 3 = 5. These
are the results we want, according to the specification.
Now what if by accident the modulus (%) operator was used instead of the left shift (<<)
operator? This would give a result of 0 - 1 = -1 for Level 1, 0 - 2 = -2 for Level 2, and 2
- 5 = -3 for Level 3. The immunity duration would not get displayed, despite the good
code that is in place to display this duration to the user. An Algorithm defect has struck!
Documentation defects occur in the fixed data assets that go into the game. This
includes text, audio, and graphics file content, as listed here:
User interface elements (labels, warnings, prompts, etc.)
Dialog (human, alien, animal)
Ambient sounds (running water, birds chirping, etc.)
Body part and clothing choices
Items (weapons, vehicles, etc.)