| Maximum marks | 100 |
| Weight | 15% of the total marks for the course |
| Submission deadline | 5pm, Friday, May 24 |
| Submission mode | Electronic, using subversion |
| Estimated time | 20 hours |
| Penalty | 10% per day |
The assignment will be updated on a regular basis. Clarifications and modifications will be added as and when required. Note that answers should be submitted electronically, using subversion. You will be required to commit one or more files for each question, with specific file names. If you want to commit additional files, for functions that you may have written, that's fine. Just remember to commit the specified files for each question, since that is what we will be looking for as a starting point for your solution.
This is a group assignment and should be completed in groups of 2, unless permission has been obtained from the course convenor to work by yourself. Both people in the group must contribute equally to the assignment. It is strongly recommended that both people in the group work collaboratively, rather than split the workload and work in isolation. Please note that a engn2219 student can only form a group with another engn2219 student, and not with a comp6719 student. Likewise, a comp6719 student can only form a group with another comp6719 student, and not with a engn2219 student.
Note that all work submitted must be entirely your own work. Make certain you use quality information and that you carefully reference all the material that you use. It is unacceptable to cut and paste another author's work and pass it off as your own. Anyone found doing this, from whatever source, will get a zero for the assignment. Any material that you wish to quote should have the source clearly referenced. Read the school's policy on plagiarism, to be found in the Research School of Computer Science Student Handbook.
It is strongly suggested that you start working on the report right away. You can commit as many times as you want. Only the most recent commit will be assessed. Check that your files work on the student system before committing. Please ensure that you copy your committed files to an appropriate folder in your directory on the student system as well.
Note that the ENGN2219 assignment is for the undergraduate students and the COMP6719 assignment for the postgrad students. The two are not interchangeable. If you find problems with this assignment (e.g., something is not clear, or there are broken links), please get in contact with the course lecturer immediately.
You are to simulate the following game, in which a thief tries to steal a treasure that is located in a room and a number of cops try and capture him before he does so. Neither the thief nor the cops know exactly where the treasure is located. The treasure is invisible because it has been cloaked, but the thief has an anti-cloaking device that allows him to see the treasure, if he is within a certain distance of the treasure.
The room is rectangular. The centre of the room has the co-ordinates
(0,0). There is a circle with origin at the centre of the
room, the circumference of which provides random points for people to enter
the room. The position on the circumference is determined by generating a
uniform random angle between 0 and 2*pi. People enter the room at random
times determined by generating a uniform random integer in the range
[0..max_entry_time]. This time is the elapsed time with respect to the
entry of the previous person. Time is counted in the form of discrete time
steps.
A thief enters the room at a random time and a random point on the cirumference of the entry circle, as specified above, after the start of the game. Once the thief has entered the room, a given number of cops enter in the same way, one after the other, at random times and points, again as specified above. The room is divided into a square grid, each cell of which is a square with sides of size 1cm. A cop/thief can move one grid point at a time, in one of four directions (north, east, south, or west). They can choose not to move as well. Once they reach a wall, they can only move along the wall, or back into the room.
Each person, cop or thief, has a sensor range, a circle of a specified
radius, within which he can sense the presence of another person
(thief or cop) or of the wall. A cop will not move into a position that is within the
sensor range of another cop. If a cop knows the position of
the thief, then he can't pass on this information to another cop,
unless he is within the sensor range of that cop. That is, they need to be within each
other's sensor range.
The thief moves randomly (the default strategy), until he locates the treasure. To do so, the treasure has to be in the range of his anti-cloaking device. He steals the treasure if he moves to the same position as the treasure. The thief is captured if a cop moves into the same position as the thief. In addition, the thief knows of an escape route (a position on the grid), which the cops know nothing about. Once the thief grabs the treasure he moves as quickly as he can to the escape route. He will not try to escape before he grabs the treasure. He escapes if he lands on the escape route co-ordinates. The time limit for the game, that is, the maximum number of time steps for which the game can run, is specified. The game ends when the thief steals the treasure and escapes via the escape route or is captured or the time limit is exceeded..
You can change the default strategy to any that you like for the movement of the thief and cops. The thief should try and avoid capture and the cops should try to capture the thief.
The initial configuration is to be read from a file, which has the information in the following order (note that the origin (0,0) is located at the centre of the room):
You need to, in effect, do an animation of the game. Draw the position
of the thief, the cops and the treasure, at each time step. You can
use the drawnow function command for this purpose. You
can use the pause command to force a pause between
plots. Remember to erase the previous positions when you draw the
new positions. Explore how this can be done (you can use a number
of different approaches and is quite easy to do. For example, create
a new plot each time, although this is inefficient).
Use filled circles to indicate the different items on the plot - red for the thief, blue for the cops, green for the treasure and yellow for the escape slot. Once the thief has grabbed the treasure, change his color to brown; the treasure circle should then disappear. Show the boundary of the room as a thick black line.
Design your program keeping in mind functionality, the potential for reuse and efficiency of code. Your program should be in a file called crgame.m. You may use as many functions as required. Functions that you think can be reused must be located in separate files. Document your code as appropriate and write a short report on your approach to solving the problem and on the design of your program in this file, in the form of comments.
The marks will be allocated as follows:
| Criteria | Description | Marks |
|---|---|---|
| Your solution and design | A brief write up of your approach to solving the problem and of your program design as comments in the main program file. Good program construction; appropriate use of data structures and functions; and efficiency of code, including use of builtin operators and functions, where appropriate and error checking. Good program design will involve the creation of appropriate functions. | 35 |
| Documentation | Appropriate documentation. This includes program and function descriptions, author details and appropriate commenting of code. Also include the appropriate time spent, in hours, and your feedback, if any, on the assignment. | 10 |
| Coding Style | This includes use of indentation to make the code easy to read; descriptive variable names; and avoiding the use of global variables. | 5 |
| The simulation | The code runs and is correct. The animation is correct and has appropriate and descriptive title and labels. 10 marks will be reserved for good strategy. | 50 |
As stated earlier, you will need to submit your assignments electronically using subversion. Read the information on the assignments page for instructions on electronic submission of assignments.
If your submission is late, then a late penalty of 10% per day applies. Assignments will not be accepted one week after the deadline.
Extensions will only be given under special circumstances. Students should send an email to Dr. Ramesh Sankaranarayana stating the reason for the request and attach supporting documentation (e.g., medical certificate). This should be done before the deadline. Requests for extensions after the deadline will not be accepted.