Game Development Reference
the sum? What is it when complexity is the product? When complexity is
the sum of the number of parts, the parts are independent. When it is the
product, all the parts are interrelated.
4. What is the design of the data called when the data is information the AI
uses to help it think about (or even imagine about) the world? It is called
5. Critique the expediencies in the code that interrogates the world in the
four-set-point thermostat. Comment on the dangers versus the additional
complexity needed to mitigate the risks. In general, the wrapper code knows
the internal implementation of the world. It does not ask the world for
values; it goes in and finds those values. The world code and the wrapper
code are two separate files that must be kept synchronized. If the wrapper
asked the world via a function in the world code, the world code could
change however it liked as long as it kept the function valid. The function
would be in the world-code file. It is easier to keep one file consistent than it
is to keep two files synchronized. Internally in the wrapper, the parallel
arrays are very handy, but they must be kept synchronized. In addition, the
settings are in time-sorted order, and the search for the right setting silently
depends on this fact. If the settings were allowed to be changed, the code
that stores the new settings would have to sort them. Expediencies should be
kept localized; within a routine is fine, within a file is tolerable, and across
files is questionable.
6. Why is the side effect in the code that gets the set-point temperature in the
four-set-point thermostat important? The side effect of showing the tem-
perature used helps let us see what the AI is thinking.
1. Define a finite state machine and tell what each part does. A finite state
machine is composed of states and transitions. The transitions are used to
change from one state to another. The states are used to define the different
things the machine will do.
2. What are the advantages of a finite state machine compared to hard-coded
AI? The formal organization combats complexity by making the states