COMP 303 Fall 2009

Milestone 2 - Game Engine and AI

Version 1.1 - 2 October 2009

Objectives

To provide an opportunity to gain additional experience and skills with:

Required Problem 1

Note the required problems do not need to be completed sequentially. It more desirable to work on them in parallel.

Implement the model module (see the project overview).

This module should be made accessible through a class model.GameEngine that will control the state and playing of the game for one human and 3-7 computer players. This state should include, for example, the cards played, the state of the deck, the score of each player, which player is the dealer, everyone's social rank, etc. This module should have no GUI, but should provide an API allowing clients to "play" the game, i.e., change the state of the object to allow it to control the playing one complete game (which involves multiple hands). Example of methods in your GameEngine API would typically include newGame(), discard(...), etc.

It is your responsibility to design a module with an interface meeting the principles seen in class, and that will make it as convenient as possible to create the user interface.

Besides the main GameEngine class, you can create as many helper classes as necessary to solve the problem.

The only "hard" requirement for the GameEngine class is that is plays the role of the Subject in the Observer design pattern.

You must provide a set of unit tests that demonstrate and test your Game module. You should have unit tests for each public method of your GameEngine class (except trivial getters and setters).

Required Problem 2

Design, implement, and test a second AI robot that implements the IRobot interface. This robot needs to be honest, i.e., decisions should not be made using any information that could not be obtained by a human player.

Your second AI robot must also be better than your first robot with 99% confidence (see Problem 3, below).

The design of the AI module should not allow the system to break the rules of the game or to cheat. Note that the "artificial intelligence" in computer players does not have to be "smart" or rely on advanced AI techniques. However, it should be reasonable and justifiable.

Required Problem 3

Provide a driver program (i.e. a main method) that simulates playing a game using GameEngine. Note that the role for the Driver is not to allows humans to play interactively, but merely to demonstrate you GameEngine API in action. For example, Driver code would typically look like:

GameEngine lEngine = new GameEngine();
lEngine.addPlayer(...);
...
System.out.println("Begin new game");
lEngine.newGame();
...
lEngine.getHumanPlayer().discard(...);

and so on.

Your driver should programmatically (automatically) play 1000 games between four of your IRobots (two basic, two advanced), record the number of games won by each type of robot, and output the number of games played and the number won by each type of robot. If 537 games or more are won by an M2 robot, you have 99% confidence that your M2 robot is better than your M1 robot.

Download

This bundle expands the m1-1 skeleton with very basic examples of a GameDriver, GameEngine, and a basic GUI that interacts with it.

Bonus Problems

To make the game more exciting, and to obtain more points on your project. Only tackle bonus problems if you can complete the basic requirements. Bonus marks will be at the discretion of the markers based on the sophistication level of the bonus features, up to a maximum of 20% of the total mark for the milestone. The following are ideas for extension. Other ideas may be considered: please discuss them with the instructor.

Bonus Problem A - Gambling Mode

In the GameEngine, build in support for vegas-style playing, where players exchange money based on their score, and where it is possible to play multiple games in one session.

Bonus Problem B - Statistics

In the GameEngine, build in support for accumulating stats about the performance of the players in persistent storage.

Bonus Problem C - Save/Load

In the GameEngine, build in support for saving the game (at any point), and loading a previously saved game.

Bonus Problem D - Plug-in framework for robots

In the GameEngine, build in support for loading an open-ended number of different robot types, and using these types in the game.

Deliverables

A zip file containing:
  1. All the code and binaries of your project.
  2. All the unit tests you developed for the GameEngine and robots.
  3. The code of the test driver.
  4. A UML state diagram modeling the GameEngine class. The diagram must be in jpeg format.
  5. A text file (ASCII) with maximum one page of text explaining your main design, addressing the design points mentioned in "Required Problem", and explaining the rational behind the AI "behavior" you have implemented.
Please submit through WebCT. See the schedule for the deadline.

Evaluation

This part will be marked out of 35 and will be worth 35% of the overall project grade. It will also be the backbone for your GUI so it is important that you do it well. In marking your project, we will looking for the following points: