Project

News

Updates will show up here.

Goal

The main goal of the project for this course is to give you a chance to play around with some of the AI algorithms discussed in class, in the context of a fun, large problem. The game selected for this year's competition is called Pushers.

The game

The game is played on an 8x8 chessboard. There are two types of pieces on the board. Pushers (larger in size) and pushees. The game starts with one row of pushers behind a row of pushees for each player. The goal of the game is to reach the other side of the board with one of your pieces.


Pushers can move on their own in any of the three forward directions. Pushees cannot move on their own and can only be pushed in any of the forward directions. Pushing can only be done in the relative direction of the pieces. The pusher will stay in its place after the push.






A player can take an opponent's piece by moving or pushing one of her pieces over the opponent's piece. A player wins the game if she gets to the opposite side with any of her pieces, or when the opponent runs out of pushers (i.e. cannot move anything).

The rules are simple, but the gameplay is complex enough to favour players with good tactics and long-term strategy.


The client/server software

Download the Java server and client software here.

During the tournament, the game will be played with each player running on a different computer (to avoid contention for CPU). The players will communicate with the server via TCP socket connections. Of course, the server and clients can all be run on the same machine too.

The server and an example client are provided. Please see the README.txt file for a description of the included files.

To run a server and two random players on the local machine:

  1. Download and extract the code. In the directory containing the code, compile with
       javac boardgame/*.java pushers/*.java 
  2. Launch a server to listen on port 8123:
       java boardgame.Server -p 8123
    The server GUI appears.
  3. In a different console, launch the first player to connect with:
       java boardgame.Client pushers.PRandomPlayer localhost 8123  
  4. In yet another console, launch the second player:
       java boardgame.Client pushers.PRandomPlayer localhost 8123  
There are shell scripts provided in the package to do the above tasks automatically. The game starts as soon as both clients are connected.

The server software also allows for locally running clients to be launched from the GUI (using the Lunch menu), for humans to play against software players or other humans, and for game log files to be viewed.

See the README.txt file for more information on running the client and server.


Implementing a player

A framework is provided to help you implement your player. It handles communication with the server and maintains a copy of the current game board. You are also provided with the source code for a simple random player (the class pushers.PRandomPlayer), which you may use as a starting point.

To implement a player, create a class that impelments pushers.PPlayer. You need only define two methods:

  1. a default constructor which MUST include your McGill ID
  2. the chooseMove() method
Then your new PPlayer subclass can be passed as an argument to the client software.

A simple player will look like this:

////////////////////////////////////////////////////////////////////////
package mypackage;

import pushers.PPlayer;

public class MyPlayer extends PPlayer {
   
    /** A default constructor is needed so that the client 
    software can create a MyPlayer object. */
    public MyPlayer() {
        // The string passed to the Player constructor will be 
        // used to identify the player to the server. In your 
        // final version, this should be your McGill ID. 
        super("MY-MCGILL-ID"); 
    }
    
    /** Choose a move to play */
    public Move chooseMove(Board theboard) {
        // Pick a move to play somehow...      
        return move;
    }
} 
////////////////////////////////////////////////////////////////////////

To run this player instead of the random player, pass it as the argument to the client software:
    java boardgame.Client mypackage.MyPlayer localhost 8123  

Documentation:
The boardgame.Player and pushers.PPlayer classes also provides other methods. See the source code for boardgame.Player, pushers.PBoard and pushers.PPlayer for further documentation.

You are not required to use the provided PBoard and PMove classes in your code. It may be preferable to represent the board in a way better adapted to the particular algorithms you will use, since these classes were written with the server in mind. In fact, you are not required to use any of the client software provided as long as your player correctly communicates with the server and runs on the SOCS lab machines. Java remains the recommended language, but use whatever you are most comfortable with. (If you're mainly worried about performance, do some research before making a decision.) You are reminded that your code must run on Linux; if you have any special requirements, ask.


Advice

Some hints on writing a winning player:

  1. Play the game against the random player, your player and/or other people to get a feel for the strategy required.
  2. Start small and build up your player incrementally. Here is a natural progression of steps:
  3. Test your code after each significant change. Make sure you always have a working program.
  4. Experiment to see what effect your changes have. Leave yourself time for tweaking your player and trying out different approaches.
  5. Ask questions if you

Requirements and evaluation

What to submit:

You should hand in two components:
  1. An implementation of your player program.
  2. A written report documenting your approach. (Required for the final submission)
Both of these components are mandatory in order to receive a passing grade on the project. The minimum requirement is for your code to be able to defeat the random player that is provided as an example. It is mandatory that you have a working and documented program. Programs that are not working will not receive credit. Programs that are not documented will not receive full credit.

Special files:

Make sure submit these files with your program:
  1. A README.txt file which includes any extra requirements or necessary information about your code.
  2. A runclient.sh script that runs you player. For players implemented in java, there is a sample script provided in the package. Make sure you change the name to run your player instead of the random player. This will help us automate the tournament.

Due date:

The due date for your final code and report is April 8, 2011 (the last day of classes). Results will be posted on the website as they become available.

Language:

Your implementation can be carried out in the programming language of your choice. The recommended language is Java and supporting code for that language is supplied to simplify your task. You should focus on providing 'intelligence' for your player.

Limitations:

There will be a 10 second time limit for each move. If you fail to return a move in that time, you will loose the game. The size of the submitted file should not exceed 10MB. You code cannot use the network except for the communication with the server. Your code should run on the machines located in Trottier room 3120 (Krieble lab). These are the specification of the machines (to the best of our knowledge):
  1. Intel Core(TM)2 Duo CPU @ 2.40GHz
  2. 2G RAM
  3. Running 32 bit Linux

Report:

The report must be typed and grammatically sound. The suggested length is 5-8 pages (~300 words per page), but the most important part is to produce a report that is clear and concise. The report must include the following required components:
  1. An explanation of how your program works, and a motivation for your approach.
  2. A brief description of the theoretical basis of the approach (about a half-page, in most cases); references to the text of other documents, such as the textbook, are appropriate but not absolutely necessary. If you use algorithms from other sources, briefly describe the algorithm and give a citation to your source.
  3. A summary of the advantages and disadvantages of your approach, expected failure modes, or weaknesses of your program.
  4. If you tried other approaches during the course of the project, summarize them briefly and discuss how they compared to your final approach.
  5. A brief description (max. half page) of how you would go about improving your player (e.g. by introducing other AI techniques, changing internal representation etc.).

Tournament:

We will hold a competition between all the programs submitted by students in the class. The competition will play every player against many other players in a tournament fashion, once as White and once as Black, in order to ensure fairness.

Academic integrity:
This is an individual project. The exchange of ideas regarding the game is encouraged, but sharing of code and reports is forbidden and will be treated as cheating. Please see the syllabus and www.mcgill.ca/integrity for more information.


Submission instructions

A single zip file with your McGill ID as the name (e.g. 1234567.zip) should be send to the address comp.424.2011[A.T]gmail.com. Make sure again that you have set your McGIll ID in the code as instucted above, and that you have updated the runclient.sh script to run your own player.

All the players will be tested against the random player before the tournament and we will try to contact you if we have trouble running your player. If you have any special requirements (e.g. persistent data), include them in your email in addition to mentioning it in your README file.