Game Development Reference
In-Depth Information
the number of black squares. You will be able to switch between the two by
commenting out the one you do not want to be used.
As we have seen, the AI lives and dies on the quality of the evaluation function.
The good news is that simple methods go a long way, and they suggest the areas
to improve when they fail. The bad news is that careful testing is required to make
sure that the evaluations always behave. The code in the project will have signs of
this evolution; presenting the final code in a fully optimized form would reduce
the impact of the lesson. We will start with the game board user interface and
proceed through to the AI.
Game Board User Interface
We need to start with a new project. That will give us the form that we will use for
the board. Use Figure 6.2 or Figure 6.3 as a guide.
1. Launch Visual Basic.
2. Create a new Windows Forms Application and name it Fox And Hounds.
3. Double-click My Project in the Solution Explorer, click the Compile tab,
and set Option Strict to On. This forces us to make all potentially risky
type conversions explicit. It is not mandatory, but it is a good habit for
programmers to be intentional about conversions between numbers with
differing precision or objects of differing types.
4. Rename Form1.vb to Board.vb.
5. Change the Text property to Fox And Hounds.
6. Change the size to 450 by 530.
7. Change the BackColor property to Old Lace, which is located in the Web tab
of colors.
8. Click the File menu and choose Save All. (Do this regularly as you proceed.)
9. Drag a button from the Toolbox to the lower-left corner of the form.
Change its Name property to ResetButton and its Text property to RESET.
10. Drag a button from the Toolbox and place it to the right of the ResetButton.
Change the Name property of this new button to FoxButton and its Text
property to Fox.
Search Nedrilad ::

Custom Search