Game Development Reference
In-Depth Information
Case Else
'this helps debug in case we forget to add
' a new mode here as well as everywhere else.
Return "Bad Mode"
End Select
'this helps debug because we should never get here
Return "Broken"
End Function
25. Run the application in the debugger and change the settings. Does the
operation seem reasonable?
The heat side is perfectly reasonable, especially for a drafty old house that loses
heat quickly and is expensive to heat. The air-conditioning settings seem posi-
tively frigid, especially the night setting. A more realistic implementation would
have different temperatures for each mode, even if they kept the same times.
Doing so adds four more numbers—easily done as another parallel array, but
now the numbers interact with the mode. The DesiredTemp function now has to
be mode aware. This means that the wrapper has to be changed to get the mode
first before it gets the temperature, when before it did not matter. The existing
code, which currently works, would have to be changed and the order of the calls
fixed. When the two pieces of data were independent, there was less complexity.
If we make them interact, the complexity increases. The increased complexity
does not show up as increased length of code the way it did in the core AI, but in a
nearly hidden way pertaining to statement order. The statements are currently
close together, and the interaction would be obvious, but as the code grows, this
might now always be the case.
State of the Art
Our last thermostat is modeled after those found in the author's home. It has up
to four set points per day, with each day having independent set points, giving 28
set points for heating and 28 more for cooling. It controls a geothermal heat
pump that has two stages of cooling and three stages of heating. It also has a fan-
only setting. The set points in this thermostat are treated differently. This ther-
mostat anticipates the set points and attempts to have the temperature of the
house at the set-point temperature by the set-point time. If the set point is for 68
degrees F at 06:00, this thermostat tries to have the room hit 68 degrees F at 06:00.
Search Nedrilad ::

Custom Search