[an error occurred while processing this directive]

Assignment 02

  1. Due Date
  2. Documentation Expectations
  3. Download Files
  4. Description
  5. Submission
  6. Test Compile

Due date

This assignment is to be done individually. Hand it in electronically (using submit) before 8:00am on Tuesday, October, 10 2006. For instructions, click here.

Important Note: Late assignments will not be accepted!


Documentation Expectations

The Assignment 02 starter files that you will be given (below) are documented using the JavaDoc style of documentation (described in the textbook). We expect you to use this documentation style for all subsequent assignments. Be sure each of the program files you submit includes your name using an @author tag. Each of your public methods should also be appropriately documented. Examples are shown below to remind you.

Class Documentation
import <imported-package-name>

/**<Describe the class>
 * @author <Your-name>
 */
public class <class-name> extends <extended-class-name>
Method Documentation
/**<Describe each public method's purpose>
 * @param <parameter-name> <parameter-description>
 * @return <return-value-description>
 */
public <return-type> <method-name>(<paramater-list>)

Be sure to include an @param tag for each paramater in the method's signature.

For the details on the specific style consult the style guide. For a specific example of a documented class and the resulting Javadoc, click here.

In addition, internal documentation inside method bodies to make your code easier for readers to understand is also appropriate. Of course, documenting every line of code that you write would detract from the goal of making things easier to read, so use a reasonable amount of documentation within your methods.


Download Files

Download the A02.zip file and extract the files to your Home directory. You will use these files to complete this assignment.


Description

Daleks is a classic computer game played on a rectangular grid between a human character (“The Doctor”) controlled by the player and a number of robot-like characters (“Daleks”) controlled by the computer. (According to Wikipedia, the Daleks are “the mutated descendants of the Kaled people of the planet Skaro” who “travel around in tank-like mechanical casings”.)

In our case, we will play on a 12x12 grid generated by the Board class discussed in lectures. The Doctor will be represented by a green peg, and each of three Daleks will be represented by a black peg.

The Doctor and the Daleks take turns moving, with the Doctor moving first. The Doctor can move in several ways. If the player clicks on one of the squares immediately surrounding the Doctor (any of the up to eight surrounding squares), the peg is moved to that location. Clicking on the Doctor does not move the peg, but instead allows the Doctor to wait in place for a turn. Clicking on any other square causes the Doctor to teleport to a random square (perhaps by using a “sonic screwdriver”). Teleportation is completely random. The Doctor may end up at any square, even the original square or a square occupied by a Dalek.

The Daleks are controlled by the computer using a very simple scheme. Each Dalek attempts to move toward the Doctor by the most direct route, moving up, down, right, left or diagonally. For example, if the Doctor is above and to the right of a Dalek, it will move diagonally. If the Doctor is directly below a Dalek, it will move down. If a Dalek moves onto the square occupied by the Doctor, the Doctor is captured. When the Doctor is captured, his peg is replaced with a yellow peg to indicate that the player has lost and the game ends (no more moves should be made).

If two Daleks move onto the same square, they crash. A red peg is placed at the site of the crash, and the Daleks involved in the crash are not moved again.

If a Dalek moves onto the site of a previous crash, it joins the crash and is not moved again. If all three Daleks have crashed, the player has won and the game ends.

The initial positions of the Doctor and Daleks are randomly chosen. Because the positions are random you can either recognize when multiple participants start on the same square and update your game state immediately (2 Daleks immediately crashed, Doctor immediately captured and game over, or all three Daleks immediately crashed and Doctor winning if he's not on the same square), or you can take steps to ensure that each participant starts on a different square. Either solution is acceptable.

Finally, if two or more Daleks simultaneously land on the square the Doctor is on, the Doctor is captured and the game is over. And if the Doctor lands on the same square as two or more crashed Daleks, the Doctor is considered captured and the game is over. Again, in both cases, the peg for the Doctor is replaced with a yellow peg to indicate a capture, an appropriate message is shown at the bottom of the screen, and no further moves should be accepted.

Implement the Daleks game as follows (these details have also been provided for you in the starter code for this assignment that you downloaded above):


Submission

Electronic Submission

This assignment will be submitted electronically. Go here to see information about how to submit files electronically.

Files to Submit

Note: We will be compiling and running your programs. Be sure your program compiles.

After you have gone through the steps for electronic submission (by running an X11 window and executing the submit command), if you want to check to see what files have successfully been electronically submitted, click the button below and enter your Quest password.



Compilation Request

Select the assignment number and press the button to request that the files for the specified assignment be compiled and run. This facility is here to allow you to ensure that you have:

  1. submitted all required pieces of code
  2. no compilation errors
  3. no package names

You may not request testing for a particular assignment once its late deadline has passed. The results will be emailed to the specified userid upon the next scheduled test run (every 10 minutes).

[an error occurred while processing this directive]