Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP30024 Artificial Intelligence
1 Overview
In this second part of the project, you will write an agent program to play the full two-player version
of Tetress. Before you read this specification it is a good idea to re-read the ‘Rules for the Game of
Tetress’ document to re-familiarise yourself with the rules. A link to this as well as a browser based
app of the game can be found on the LMS where you found this document.
The aims for Project Part B are for you and your project partner to (1) practice applying the
game-playing techniques discussed in lectures and tutorials, (2) develop your own strategies for
playing Tetress, and (3) conduct your own research into more advanced algorithmic game-playing
techniques; all for the purpose of creating the best Tetress–playing program the world has ever seen!
ò
Similar to Part A, you can (and should) regularly submit to Gradescope as a means to
get immediate feedback on how you are progressing. The autograder will be equipped
with simple (not particularly clever) “test” opponent. See the Submission section at
the end of this document for details.
Both you and your partner are expected to read this specification in full before commencing the
project, then at your earliest convenience, you should both meet up and come up with an action
plan for tackling it together (see Section 4.2 for our expectations regarding teamwork).
1.1 The Task
Your task is twofold. Firstly, you will design and implement an agent program to play the
game of Tetress. That is, given information about the evolving state of the game, your program
will decide on an action to take on each of its turns (we provide a “referee” program to coordinate a
© - University of Melbourne, 2024 1
game of Tetress between two such programs so that you can focus on implementing the game-playing
strategy). Section 2 describes this programming task in detail, including information about how
the referee program will communicate with your agent program and how you can run the referee
program.
Secondly, you will write a report discussing the strategies your program uses to play the game, the
algorithms you have implemented, and other techniques you have used in your work, highlighting
the most impressive aspects. Section 3 describes the intended structure of this document.
The rest of this specification covers administrative information about the project. For assessment
criteria, see Section 4. For submission and deadline information see Section 5. Please seek our help
if you have any questions about this project.
2 The program
You have been given a template Python 3.12 program in the form of a module called agent.
Alongside this module is the “driver” module named referee, which is what is used in the sub-
mission (and tournament) environment to verse two agents against other and enforce the rules of
the game. We’ve given this to you so you can test your agent locally, but it’s also a good idea to
make periodic submissions to Gradescope like you did in Part A of the project. We have provided
a simple (not very clever) agent that you can playtest your work against in this environment.
ò
Before continuing, download the template and follow the “Running the template code”
guide on the assignment LMS page. Once your local development environment is set
up, try running the command python -m referee agent agent This will play the
template agent module against itself (naturally this will result in a failed game as it’s
not implemented yet!).
Further details regarding how to use the referee module, how it interacts with your game playing
agent(s), as well as the high level process involved in playing a game are specified in the following
subsections. It is important you read these carefully to make the most of what we have provided
you and hence minimise wasted effort.
2.1 The Agent class
Within the agent module that comes with the template project you will find a program.py file
inside that defines a Python class called Agent. This class should not be instantiated directly,
rather, the methods of this class are invoked by the referee throughout a game of Tetress and
hence serve as an interface for your agent to play the game.
The Agent class defines the following three methods which you must implement:
1. def init (self, color: PlayerColor, **referee: dict): Called once at the be-
ginning of a game to initialise your player. Use this method to set up an internal representation
of the game state.
The parameter color will be PlayerColor.RED if your program will play as Red, or the string
PlayerColor.BLUE if your program will play as Blue. Note that that the PlayerColor enum
is imported from the referee.game module – you will see numerous types like this in the
template. We discuss the **referee param later on, as this is common to all methods.
2. def action(self, **referee: dict) -> Action: Called at the beginning of your agent’s
turn. Based on the current state of the game, your program should select and return an action
to play. The action must be represented based on the instructions for representing actions in
the next section.