APCS hw 1 - meets an obstacle. 6: What happens when a bug...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Ashwin Raghuraman 1/11/2011 Period 1 APCS homework 1: does the bug always move to a new location? Yes, unless the int = 0 or else the bug will stay in place and spin in circles, also if there are rocks completely boxing in the bug it will keep turning to the right and never reach a new position inside of the grid. 2: In what direction does the bug move? The bug will move forward if it has a clear path in front of it, if there is something blocking its path it will turn right 45 degrees. 3: what does the bug do if it does not move? It will spin in circles clockwise when the int defining the bug is equal to 0. 4: What does a bug leave behind when it moves? The bug leaves a flower which gradually changes colors indicating where the bug previously was. 5: what happens when the bug is at the edge of the grid? If it is facing the grid its path will virtually be blocked, so it will keep turning right until it has a space to move. If it wasn’t facing the wall directly, then the bug would continue on its original course until it
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: meets an obstacle. 6: What happens when a bug has a rock in the location immediately in front of it? The bug will turn clockwise 45 degrees until it has a space to move directly in front of it. 7: does a flower move? No but it changes colors based on the last time the bug tred on the spot where it was placed. 8: what behavior does a flower have The flower shows where the bug has previously gone, and how long ago the bug was placed in that spot. 9: does a rock move or have any other behavior? The rock is defined as an inhibitor of the bug nothing else, if there is a rock in front of the bug, it will move. 10: Can more than one actor be in the same location in the grid at the same time? Yes, but there cannot be 2 rocks in the same slot but bugs and flowers have the ability to overlap one another....
View Full Document

Ask a homework question - tutors are online