Game AI.Reversi .*;
Reversi Example 1: Simple Rules, Not Thinking Ahead
The only thing the AI is concerned with in this example is the amount of opponent pieces it can take with each move. It'll go for the most pieces without thinking about the consequences in future moves. It doesn't think any number of moves ahead, only the present one. Because of this, it makes no attempt to defend itself. This, of course, makes it a very easy opponent to beat.
Figure 1. The corners are real easy to take from the AI. Note how the AI, in black, could easily take the corner from me (marked in red), but instead decides to take the move in blue because it can get more pieces immediately.
Figure 2. Could have had the corner, but I took it, and a bunch of its pieces too.
Figure 3. Excerpt from Engine.java from resersi1.jar. This is the only AI. A function called findAllPossibleMoves make a list of moves the AI can make (red underline), then the list is searched for the move that gets the most opponent pieces (blue box).