Next: Robot Control Up: Connect 4 as a Previous: Protocol---Child Side

Play Strategy

Before codifying a strategy for playing the game, the students in the class played a number of games, paying particular attention to identifying winning strategies. One such strategy is to set up two winning lines each with one missing piece. The two lines are arranged so that the two missing pieces are positioned at empty board positions one atop the other. Unless the opponent forces a similar win first, such a configuration will eventually lead to a win by playing to the column containing the missing pieces. If the opponent does not block the winning move for the lower line, the player who set up the trap will win. If the opponent does block the lower line, then a piece may be played to that column again causing a win in the upper line. An example of this strategy is depicted in Figure 1 where both the second and third positions from the bottom in the middle column would result in wins for the grey pieces.

The students also determined that in the absence of clear strategic direction of play, preference should be given to playing pieces that could build diagonal lines in the lower middle portion of the board.

The evaluation function used in the min-max search returns a large positive value for imminent wins and for winning situations as described above. Similarly it returns a large negative number for the same situations where the opponent would win. Otherwise, the evaluation function returns the weighted sum of occupied piece positions where the positions in the lower middle portion of the board are weighed higher than those around the edges. Positions occupied by friendly pieces are added to the sum and positions occupied by opposing pieces are subtracted. The greatest positive and negative weighted sums are of a smaller magnitude than the large numbers used to indicate imminent wins and losses.



Next: Robot Control Up: Connect 4 as a Previous: Protocol---Child Side



Brian L. Stuart