192
Video Game Design Foundations
Algorithm
An
algorithm
is a computer script that performs the steps needed to solve a
problem. An algorithm is considered to be elegant if it is the simplest, smallest,
and most efficient computer code to perform all needed functions. To form an
algorithm requires three components: structure, sequence, and iteration.
The first component of an algorithm is structure.
Structure
is the syntax
and logic form of the programming language. Structure goes beyond pseudo
code to include the actual words and symbols organized to make the computer
perform as desired.
The second component of an algorithm is sequence.
Sequence
is the
predetermined order or steps the computer program will follow. Just as outlined
in the flowchart, such as the one shown in Figure 5-19, the sequence gives
order to the instructions needed to get from start to finish.
The third component of an algorithm is iteration. An
iteration
is a single
run through a programming loop. The iteration component controls how long
and how often the algorithm will be active.
Figure 5-19.
A flowchart can be
used to break down
a process into simple,
clearly-defined steps,
as in this example for
resolving the issue of
a broken Xbox 360.
Goodheart-Willcox Publisher
Previous Page Next Page