Game Development Reference
In-Depth Information
ByVal e As System.EventArgs) Handles Me.Load
Call AI.RunAI(Me)
End Sub
Private Sub Ambient_ValueChanged(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles AmbientUpDown.ValueChanged
Call AI.RunAI(Me)
End Sub
Private Sub TimeUpDown_ValueChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TimeUpDown.ValueChanged
Call AI.RunAI(Me)
End Sub
Private Sub AirRadio_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles AirRadio.CheckedChanged
Call AI.RunAI(Me)
End Sub
Private Sub HeatRadio_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles HeatRadio.CheckedChanged
Call AI.RunAI(Me)
End Sub
21. Now we move to AI.vb to create our more sophisticated AI. We will work
from the wrapper toward the core AI. The core AI will need to know what
operating mode to use, so the wrapper will need to get that from the
world. Likewise, the core AI will need to know the right set-point tem-
perature. The wrapper will need to know what time it is to get the right
temperature value, but once that value is available, the core AI does not
care what time it is. Change the wrapper to match the following code
(every line changed):
'This is the public wrapper. It knows about the world.
Public Sub RunAI(ByVal World As House)
Dim mode As CurrentMode
Dim desired As Integer
'interrogate the world about our settings
desired = DesiredTemp(World)
mode = FurnaceMode(World)
Search Nedrilad ::




Custom Search