quiz2 - Name Dave's 15-100 Section M N O P Quiz 2 Reference...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Name: ____________________ Section: M N O P Dave's 15-100 January 28, 2009 Quiz 2 Reference Robot void move () //before: front must be clear void turnLeft () void makeLight () //before: must be on dark void makeDark () //before: must be on light boolean frontIsClear () boolean onDark () Help void turnRight () void turnAround () //turns to face opposite direction void backUp () //before: back must be clear //after: robot has moved back 1 // square, facing the same // direction as before
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 1. Consider the mystery method below. public static void mystery() { if (Robot.onDark()) { Robot.makeLight(); } if ( ! Robot.onDark()) { Robot.makeDark(); } } a. If the robot was originally on a light square when mystery is called, the robot will now be on a light square a dark square b. If the robot was originally on a dark square when mystery is called, the robot will now be on a light square a dark square
Background image of page 2
3 2. Complete the leftIsBlocked method below so that it behaves as specified. //Returns true if there is a wall to the left of the
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/14/2010 for the course CS 15-100 taught by Professor Dave during the Spring '08 term at Carnegie Mellon.

Page1 / 6

quiz2 - Name Dave's 15-100 Section M N O P Quiz 2 Reference...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online