Game Development Reference
In-Depth Information
'What, if anything, sits on this?
Public Enum Checker As Integer
None
Fox
Hound
End Enum
'Just the color (used when thinking as well as for display).
Public Enum SquareColor As Integer
Black
White
Green
End Enum
GameState class
We are finally ready to start on the class for the state data. Add a class to the
project and name it GameState.vb. Add the following data to that class:
'The fox and hounds are the minimum.
Dim Fox As Integer
Dim Hounds(3) As Integer
'But it is very useful to analyze the board.
Dim Turn As Integer
Dim Rank As Integer
Dim Squares(31) As SquareData
Now we want to create a brand-new game state. Later on we will add a method
that creates a new game state as a copy of a given state. Since this file will contain a
good deal of code, we use regions to be able to group like parts together and to be
able to collapse them out of sight. And the following code to the class:
#Region "Class New"
Public Sub New()
Dim i As Integer
'New game locations; fox on bottom row.
Fox = 30
Fori=0To3
'Hounds go in the top row.
Hounds(i) = i
Next i
 
Search Nedrilad ::




Custom Search