import stanford.karel.*;
public class CollectNewspaperKarel extends SuperKarel {
public void run() {
moveToDoor();
pickBeeper();
backToRoom();
}
/**
* move Karel to the door
*/
private void moveToDoor() {
for(int i=0;i<3;i++) {
move();
}
turnRight();
move();
turnLeft();
move();
}
/*
* move Karel back to the original place
*/
private void backToRoom() {
turnAround();
move();
turnRight();
move();
turnLeft();
for(int i=0;i<3;i++) {
move();
}
turnAround();
}
}
CS106A assignment1 problem1
猜你喜欢
转载自blog.csdn.net/weixin_44343916/article/details/86236670
今日推荐
周排行