Game Development Reference
Select Case StateSquare.Kind
Case SquareColor.Black, SquareColor.Green
'Green and black squares are solid.
BoardSquare.Text = ""
'White have the step number.
BoardSquare.Text = Squares(i).Steps.ToString
With some help from the board, we will be able test what we have. We will return
to add more functionality to the GameState class, but we can leave that for later.
The board itself will need to store some data. We need our buttons and the game
state used to paint them. As you may have guessed from the figures, we will
support an undo function, so we will need to stash the prior boards away. View
the code for Board.vb and add the following to the class:
Dim BoardSquares(31) As FaHButton
'Our current game:
Dim ThisGame As GameState
'The boards before this one so we can undo:
Dim PriorBoards As New Collection
We will do one-time initializations in the form Load event handler. Once those
are done, we will ask the reset button click handler to start a new game for us.
Add the following code to the class:
Private Sub Board_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim sq As FaHButton
Const sqsize As Integer = 50
'Do the once per run stuff.
sq = New FaHButton(i)