[Texas PLT logo]

COMP 202: Principles of Object-Oriented Programming II

  Games for Two  

Homework #6 and #7: Games for Two

Milestone #1: See Owlspace for due date.

Milestone #2: See Owlspace for due date

Please note our README Guidelines and our submission instructions.

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

You are given the following.

All of the files from 1. to 3. below can be downloaded as one zip file: hw6-7.zip. It includes a DrJava project file called games.xml. However, to use it, you have to change the "Extra Classpath" in the "Project Properties" dialog:

When you start working on the stubbed-out code for GameModel.java, make sure to remove the P4M2.jar file again! If you don't, it will use the code in P4M2.jar, not your own code!

When you start working on the stubbed-out code for TicTacToeBoard.java, make sure to remove the tttboard.jar file again! If you don't, it will use the code in tttboard.jar, not your own code!

  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. 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.
  3. 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).
  4. 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.

  5. The UML and javadoc that describes framework design.

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 #6) 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

More detail about the 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...
  Games for Two  

URL: http://www.cs.rice.edu/teaching/202/08-fall/hw/games/index.shtml
Copyright © 2008-2010 Mathias Ricken and Stephen Wong