GridWorld Part 3 Exercise: Jumper

posted by: Mr. Bergquist 22 March 2012 No Comment

Pair up and work with a Partner on this one, it is a little tricky.   You will complete the Jumper class as detailed in the GridWorld case study part 3 document (make sure to read through it before beginning).  This actor can move forward two cells in each move. It “jumps” over rocks and flowers. It does not leave anything behind it when it jumps.

NOTE: a Jumper can’t use the same canMove and move methods as a Bug.  That implies it is a sibling of a Bug.

Use the specifications below.  When you get checked off, you will need to efficiently show that you’ve addressed each case.  That means you need to have a clear testing plan in mind – Please develop a written series of instructions to follow or collection of client programs to provide the necessary testing.  Test planning is an important part of software development.

Specifications

a. What will a jumper do if the location in front of it is empty, but the location two cells in front contains a flower or a rock?
Move one cell only.
b. What will a jumper do if the location two cells in front of the jumper is out of the grid?
Move one cell only.
c. What will a jumper do if it is facing an edge of the grid?
Turn like a Bug.
d. What will a jumper do if another actor (not a flower or a rock) is in the cell that is two cells in front of the jumper?
Remove the other Actor and jump to that location.
e. What will a jumper do if it encounters another jumper in its path?
Jumpers are treated the same as any other Actor.
f. Are there any other tests the jumper needs to make?
If both the cell directly in front of and the cell two spaces in front of the Jumper are both blocked, turn like a Bug.

1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 3.00 out of 5)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>