Graphics Reference
In-Depth Information
Table 8.2 AI block accuracy
with different priority number
approaches
Algorithm type
Unweighted
Weighted
Number of correct answers
17
20
8.3.2 AI Experiments
In order to evaluate which priority number approach produces better results we
collected 20 tic-tac-toe situations to use as test input. As a reference, we manually
determined the optimal moves for each situation. We presented the test inputs to
both approaches and compared their results to the reference results. Table 8.2 lists
the number of correct results produced by the two AI algorithms.
We see that the weighted algorithm worked the best. In the cases where only
the weighted algorithm worked properly, the app had multiple options. One option
allowed the program to possibly win while the other always resulted in a draw. So,
the more “aggressive” weighted approach chose the winning moves and won those
games.
8.4 App Integration and Testing
We integrated our app using standard Java SDK tools for Android development [ 11 ].
As a starting point we used the Stanford EE368 Viewfinder [ 12 ], which provided
us with the code for using the Android camera and the images in the memory. The
Viewfinder also demonstrates a few useful techniques: how to access the image in
the memory and how to display graphics on the screen. We added our vision and AI
code to the Viewfinder and modified its display routines to accommodate our needs.
The result can be seen in our YouTube video [ 13 ].
We played with the app extensively, identified and fixed a number of small bugs,
and concluded that the app is fairly robust to global illumination changes. In fact, in
our regional science fair demonstration we had to work in very dark conditions and
our app still worked great.
In Fig. 8.6 we show the final appearance of the device display when our app is
running. As indicated by the yellow circle, the recommended next move is X in the
lower right corner. It is a good move because it blocks O from winning and opens
up the opportunity to win on that diagonal.
A video demonstration of our app can be found on YouTube:
www.youtube.com/watch?v=TCoBJy_W1ms.
 
Search WWH ::




Custom Search