Sunday 6 February 2011

Gridworld Part 1

Gridworld: Set 1 page 6



1. Does the bug always move to a new location? Explain.
Not always, it sometimes turns or moves in a circle. 
2. In which direction does the bug move?
Straight until something obstructs it which in that case it turns until it finds a free cell.
3. What does the bug do if it does not move?
turns 
4. What does a bug leave behind when it moves?
Flowers  
5. What happens when the bug is at an edge of the grid? (Consider whether the bug
is facing the edge as well as whether the bug is facing some other direction when
answering this question.)
It turns clockwise and continues its route 
6. What happens when a bug has a rock in the location immediately in front of it?
It turns and moves to a different cell which is free 
7. Does a flower move?
No, they just change colors 
8. What behavior does a flower have?
It changes colors(into a darker color and eventually to black) 
9. Does a rock move or have any other behavior?
Nope 
10. Can more than one actor (bug, flower, rock) be in the same location in the grid at
the same time?
Nope 

Gridworld: Part1: Exercises page 8




1. Test the setDirection()   method with the following inputs and complete the table, giving the compass direction each input represents.



degrees
compass direction
0
North
45
 North East
90
 East
135
 South East
180
 South
225
 South West
270
 West
315
 North West
360
 North

2. Move a bug to a different location using themoveTo()   method.

In which directions can you move it?

How far can you move it?

What happens if you try to move the bug outside the grid?

3. Change the color of a bug, a flower, and a rock.

Which method did you use?
setColor method 
4. Move a rock on top of a bug and then move the rock again.

What happened to the bug?
The bug is gone. The rock probably squished it.. 

**********************************************************************************
MR DALY,
I DID THESE EXERCISES IN CLASS WITH AMIT ON HIS COMPUTER SINCE I DID NOT HAVE MINE AT THE TIME. HOWEVER, I AM NOT ABLE OF MAKING GRIDWORLD FUNCTION PROPERLY ON MY LAPTOP WHICH IS WHY I CANNOT COMPLETE PART 2
PLEASE TAKE THIS INTO CONSIDERATION AND HOPEFULLY WE WILL FIX THE PROBLEM TOMORROW IN CLASS
THANKS,


JONATHAN
**********************************************************************************

No comments:

Post a Comment