Xinhong's Page

a datetime

Program Specification

There are 10 classes implementing the program:

General Design:
The othello applet has three component, button panel, board, message panel. There is a Timer thread running currently with board and button handling, showing time past on the message panel. The board starts a thread Wrapper to handle the animation display while itself does all the computation.

Description of classes :

Othello extends the Applet class and is the main program. It creates a board (of class Board), the buttons to handle the game, and a timer( of class Timer) to calculate the time for each set of game.
Request: There are 7 kind of requests: Position is almost the same as that in connect-four game, except that each position has two states: Beause there is a delay between the time mouse is down and the time the position is repainted, two states are used to allow the concurrency of Board and Wrapper. Using one state requires locking the state when display the position, because it may change the real state of the position and make the computation in board take the wrong value.

The Wrapper handles almost all the paint jobs exception the showing for a valid move so when the wrapper animately display the flips, the valid move for the next player is still available. It picks one request from the head of the board's buffer, checks the request type, does some work accordingly, remove this request, and then sleep for a delay period.
Board: The board does all the computation and artificial intelligence (or kind of) stuff. Whenever it has display need, it sends a request to the buffer called myQueue, which is of Vector type, and then continue with next conputation. The only painting it does is to highlight the valid move, because it can be concurrent with the animation. The basic algorithm for choosing a best move only looks ahead once, which is:

Timer is a subclass of Thread used by Othello main program, when a new game begins, timer is spawned. When the game is over, timer is stopped.
MSGbar is a Panel for the timer to display.
MessageWin is the class for popping up message. It has two constructors, one for popping up a skip-turn message, the other for poping up the final score window when the game is over. An 'ok' button closes them.
About class pops up a small window to show the author information.
Picture class extends Canvas to show the picture of the author, used by About class.

Status of the program

I believe I have finished all four levels. But I am not sure whether the sound would play correctly because I don't have a sound card and speaker on my machine.

Defects of the program