/*The requirement is to add the necessary code to
* instruct Karel to walk to the door of its house, pick up the
* newspaper (represented by a beeper, of course), and then return
* to its initial position in the upper left corner of the house.
*/
import stanford.karel.*;
public class CollectNewspaperKarel extends SuperKarel
{
public void run()
{
move();
turnRight();
move();
turnLeft();
move();
move();
pickBeeper(); //Picked up the Beeper
turnAround();
for(int i=0;i<3;i++) //On the way back
{
move();
}
turnRight();
move();
turnRight();
}
}
No comments:
Post a Comment