COMP 202: Principles of Object-Oriented Programming II← Games for Two → |
Home — Fall 2008 | | | Information | | | Resources | | | Exam Resources | | | OwlSpace | | | COMP 201 |
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 IBoardModel. ABoardModel 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!
You are allowed and strongly encouraged to work in teams of at most 2 people.
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:
P4M2.jar
and the tttboard.jar
entries.P4M2.jar
file back so that it uses the path on your system.tttboard.jar
file back.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!
An important piece of code in GameModel.java is stubbed out. You will be required to complete it.
Your task for this project is to do the following.
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!
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:
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.
Be sure to properly initialize _val in MinAcc and MaxAcc. What do you want to happen the very first time that updateBest() is called?
When creating an (x,y) Point from a (row, col), which is the row and which is the col?
Be very conscious of what player to use when. The supplied "player" is not necessarily the one you want! Who knows the proper player for the moment?
To calculate a random number between 0 (inclusive) and N (non-inclusive), use (int)(N*Math.random()).
Be sure to redraw the whole board, not just the one token that was placed. This does not affect Tic-Tac-Toe, but does affect Othello.
Should the game halt before or after the view is notified of a win/lose/draw?
You should add skip control to your IRequestor. TurnControl can be set so that setProceed() will skip the next player. Who can figure out whether or not a player is to be skipped? Which player needs to tested for skipping?
How can you calculate (no if's please!) the value with which to update the accumulator, when you only know which player won and not which player you are? For instance, suppose player 0 won, but all you know is that you are "modelPlayer". How can you calculate the proper value {-1, +1} to update the accumulator with? Consider this: if modelPlayer=0 then value = +1, but if modelPlayer = 1 then value = -1. Can you create a single formula will properly calculate the value given the modelPlayer and the fact that player 0 has won?
URL: http://www.cs.rice.edu/teaching/202/08-fall/hw/games/index.shtml
Copyright © 2008-2010 Mathias Ricken and Stephen Wong