Comp 212 - Spring 2005

Project #4: Design Patterns For Games

This project is not about Tic-Tac-Toe nor Othello.  It uses a 2-person game design as a vehicle to learn BIGGER concepts in computing:

In this project, you will be given a big chunk of a 2-person board game framework and asked to write a few of its components, plug them in and obtain a program that can run Tic-Tac-Toe and Othello with different types of players, human and/or computer, using a variety of strategies to compute the next move while playing the games.  See the on-line demo!!  (You are not allowed to reverse engineer the demo to do your project).

The given game framework abstracts and decouples the different components in a game and specifies them in terms of interfaces with only pure abstract behaviors.  For example, the rules of a game is abstracted and encapsulated in an interface called IBoardModelABoardModel is a specific implementation of this interface using the state pattern.  Playing a particular board game is a matter of writing a concrete subclass of ABoardModel and plug it into the framework.  Nothing in the framework is changed!


Pair Programming

You are allowed and strongly encouraged to work in teams of at most 2 people. 

Resources

Othello Game rules: From Pressman Games, the manufacturer
Web page of an Othello fanatic: http://www.maths.nott.ac.uk/othello/othello.html

You are given the following.

  1. The source code of most of the game framework: P4M2Source.jar.  You can extract all the files from this jar file by enter the command:
  2. Among the source files is GameModel.java which is the class that encapsulates:

    An important piece of code in GameModel.java is stubbed out.  You will be required to complete it.

  3. The UML and javadoc that describes framework design.
  4. The binary class files of the complete framework: P4M2.jar.  You are allowed to reverse engineer it to study the design, but not to reverse engineer the code.
  5. The binary class file for the TicTacToe game board:  tttboard.jar.  It contains the class files for TicTacToeBoard, a class that you will be required to implement (i.e. write the code).

Your task for this project is to do the following.

  1. Fill out the stubs in the GameModel.java (in the "model" package), i.e. instantiate the IRequestor object.  The upcoming lab (lab #12) will help you with this part.
  2. Implement the Tic-Tac-Toe board model by completing the provided skeleton TicTacToeBoard.java.
  3. Implement a random move strategy that selects a move from the set of legal (i.e.valid) moves only.  Hint: take a look at RandomMoveStrategy.java and the stubbed out RandomValidMove.java file.
  4. Implement MinMax principle.
  5. Implement Alpha-Beta pruning strategy.
  6. Implement Depth-limited search strategy that works for any specified depth..
  7. GameModel.java has a method called getPlayers().  In this method, the code to add players playing the strategies described in items 3, 4, 5 in the above is commented out.  These strategies must be written in such a way that when this code fragment is uncommented, the whole GameModel.java will compile and run properly.
  8. Be sure to document (in javadoc style) all the code you write.

Use the user ID of one of the team members as the package name for all of the above strategies.

See the Hints on INextMoveStrategies page!

Submission

The project is to be submitted electronically.

Milestone 1 Requirements:

Milestone 2 Requirements:

No late submission will be accepted.  The submission should contain the following:

All submissions MUST contain the following:

 


Othello Tournament

During the week of the final, we will hold a tournament to select a new Othello champion.  Participation is totally optional.

P4M2.jar is the binary that will be used for the Othello tournament.  To run the code, enter the following command (on Owlnet Solaris  machines).

java -classpath .:P4M2.jar:tttboard.jar controller.GameApp

In Windows, the command is

java -classpath .;P4M2.jar;tttboard.jar controller.GameApp

We will announce the tournament rules later.  One key rule is for you to use your user id as the package name for your best Othello next move strategy.


Tips and Traps

In no particular order...