Experiments in Java


Problems for Session O1: Object-Oriented Design

Problem O1-A: Describe a game

Pick a game and write a short two paragraph description of the game comparable to the description of Othello from this laboratory. Using this description, identify the objects and classes that might be used in a simulation of that game.

Problem O1-B: A simple Othello interface

We are on our way to a working Othello game. The first step is to get a working interface. You will need

By filling in the details, you should be able to get a simple working interface for the Othello game in which players can enter moves and see a board. At this point, the pieces should not flip and may not even display.

Note that as you fill in the details, you may realize that you need additional methods. For example, although we have not discussed it, the Board class will clearly need a placePiece method.

Problem O1-C: Update Board

Update the Board class so that it will remember where pieces are placed on the board and display them appropriately.

Problem O1-D: Update Rules

Finish the Rules class. You will need to ensure that it is able to

This problem is perhaps the most difficult in this assignment.

Problem O1-E: Changing Othello's board

Using your code from the previous problems, update Othello so that it is played on a rectangular 6x8 board. What classes did you need to change?

Problem O1-F: Changing Othello's rules

Using your code from the previous problems, update Othello so that the initial state of the board contains two black pieces and two white pieces on the center four squares, with the black pieces forming a row and the white pieces forming a row. What classes did you need to change?

Problem O1-G: Changing Othello's pieces

Using your code from the previous problems, update Othello so that pieces have three colors: white, black, and red. Assume that they flip in sequence: white to black, black to red, red to white. What classes did you need to change? What other questions did you need to ask in order for these updates to be successful and useful?


Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.

Source text last modified Tue Oct 26 13:17:44 1999.

This page generated on Tue Oct 26 15:37:43 1999 by Siteweaver.

Contact our webmaster at rebelsky@math.grin.edu