Due: Friday 8 June, 8:00 pm
Marks: 16% of final assessment
The general rule is that a piece can capture another piece of equal or lesser rank, but there is an exception concerning the Elephant and the Mouse: the Elephant cannot capture the Mouse (because the Mouse is small and can dodge the attack), but the Mouse can capture the Elephant (by crawling in the Elephant's ear and gnawing at his brains).
src.zipinto your own filespace and unzip it. Then type
cd src make play ./playacYou should then see something like this:
init start . m . x . e . . . t . d . . . . . . . . . . . . . . . . . . . . . . . . . D . T . . . E . X . M . . m . x . e . . . . t d . . . . . . . . . . . . . . . . . . . . . . . . . D . T . . . E . X . M . Move?The program
playacallows you to play against your own agent. The provided file
agent.csimply chooses each move randomly among the available legal moves. In this example above, the agent has chosen to move its
LEFT(from the agent's perspective). Note that your own pieces are represented by the uppercase characters
'X'(den) while your opponent's pieces are representod by the lowercase characters '
To make your move, type one of the letters
followed by one of the letters
RIGHT, UP, LEFT or
The program will then print the
board state after your move, followed by the board state
after the agent's next move, etc.
You can win the game by either moving a piece to the opponent's den,
or capturing all the opponent's pieces.
At the end of the game, the program will print
"Human Wins!" or "Agent Wins!" and then invite you to
play another game.
agent_init() is called at the beginning of a series of games
agent_start() is called at the beginning of each game
agent_step() is called each time a move needs to be made
agent_end() is called at the end of each game
agent_cleanup() is called at the end of the series
agent_step() has this prototype:
int agent_step( int loc_p[WIDTH+1][HEIGHT+1] );The array
loc_pspecifies the current state of the board, from the perspective of the agent. The piece at column
loc_p[j][k], where the columns are numbered from 1 (left) to 7 (right) and the rows are numbered from 1 (near) to 7 (far).
The function should return a move encoded as a number between
15, as follows:
When you compare the code in
agent.c, you will notice an important distinction
glob_p describes the board in global
loc_p describes it in
This is done so that, when two agents play each other,
each agent will effectively be "deluded" into thinking that it is
Player 0 and the opponent is Player 1.
In other words,
each agent is presented a view of the board from its own perspective,
and each agent believes that its own pieces are
MOUSE_0, DOG_0, TIGER_0, ELEPHANT_0 while those of the
MOUSE_1, DOG_1, TIGER_1, ELEPHANT_1.
game.chave been provided just as a tool to help you develop your agent. For submission, your player must be compiled in a form which allows it to play against other agents through a socket protocol. To see how this works, type
makeYou will see that it compiles
client.oto produce an executable called
Note that the files
game.h are not required to produce
The contents of the arrays
can_eat, which you can see listed in
play.c, have been compiled into
as well, so you are free to use them in your agent.
Briefly describe how your program works, including any algorithms and data structures employed, and explain any design decisions you made along the way.
give cs3411 hw3 Makefile agent.c ...
Please ensure that you submit the source files and NOT any
binary file (i.e., compiled
give system will compile your program using your
Makefile and check that it produces a binary file
with the correct name.
You can submit as many times as you like - later submissions will overwrite earlier ones. You can check that your submission has been received by using the following command:
3411 classrun -check
The submission deadline is Friday 8 June, 8:00 pm.
15% penalty will be applied to the (maximum) mark for every 24 hours late after the deadline. Late submissions will not participate in the final tournament, but may be evaluated against selected and pre-defined players.
Additional information may be found in the FAQ and will be considered as part of the specification for the project.
Questions relating to the project can also be posted to the MessageBoard on the course Web page.
If you have a question that has not already been answered on the FAQ
or the MessageBoard, you can email it to your tutor, or to
You should always adhere to good coding practices and style. In general, a program that attempts a substantial part of the job but does that part correctly will receive more marks than one attempting to do the entire job but with many errors.
Group submissions will not be allowed. Your program must be entirely your own work. Plagiarism detection software will be used to compare all submissions pairwise and serious penalties will be applied, particularly in the case of repeat offences.
DO NOT COPY FROM OTHERS; DO NOT ALLOW ANYONE TO SEE YOUR CODE
Please refer to the Yellow Form, or to section on Originality of Assignment Submissions in the Unix Primer, as well as the CSE Addendum to the UNSW Plagiarism Policy if you require further clarification on this matter.