NEW SOURCE CODE, DOCS AND NOTES! (NOTE PACKAGING CHANGES FOR INTERFACES!)
Updated! See the Hints on INextMoveStrategies page!
See the new Tips and Traps section! These items come from common problems encountered by students.
This project is not about Tic-Tac-Toe nor Othello. As explained in the lecture (on-line lecture slides, download the MS Powerpoint presentation), 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!!
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: Interface docs. 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. Teams of size greater than two will need special authorization from either of the instructors of the course.
The project is divided into two milestones.
The goal of milestone one is to help you familiarize with the overall design of the game framework by focusing on the game model, which encapsulates:
The game model is represented by a class called GameModel. GameModel Docs describes its design in UML and javadoc.
In this milestone, you are to:
To compile your code, type the following from the default package directory:
javac -classpath .:game4two.jar model/GameModel.java
To run your code, type the following from the default package directory:
java -classpath .:game4two.jar controller.TicTacToeApp
Revise RandomStrategy to only select legal moves.
Implement MinMax principle.
Implement Alpha-Beta pruning strategy.
Implement Depth-limited search strategy.
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!
During the week of the final, we will hold a tournament to select a new Othello champion. Participation is totally optional.
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?
The original download of GameModel.java had a typo: There is a missing "}" in the reset() method's if statement.