Note: GridWorld is no longer featured on the AP CS A Exam (since the 2015 Exam).

As the name suggests, the AP Computer Science GridWorld Case Study is based on a grid. The GridWorld Student Manual places Actor objects in the grid; however, it can actually store objects of any type. This makes the grid useful for many 2 dimensional games such as Connect 4, tic tac toe, chess, checkers and Go.

In this project, you will write several methods to complete an implementation of Connect 4. You can also extend the project with a rule based or artificially intelligent computer player. You and your friends can even write your own computer players and run them against each other.

Download the Connect 4 in GridWorld skeleton code and import it into your IDE. The code is setup as an applet so you can display your results on a website if you wish. (Eclipse works well with applets but not all IDEs do.) As with all GridWorld projects, you must setup your IDE to reference the gridworld.jar file distributed with the GridWorld Case Study.

The code to handle clicks on the board has been included for you; however, it depends on several methods of the BoardUtilies class that you must write. BoardUtilies contains placeholders for these methods as well as documentation for each incomplete method. Provide correct implementations for each method.

To create your own computer players, extend the Player class and implement the move method. A RandomPlayer class has been provided that selects a random valid move. RandomPlayer illustrates how a computer player can use the methods of BoardUtilies.

See the completed BoardUtilities class or review it with AP CS Tutor Brandon Horn.