CS106A编程方法学二
机器人卡雷尔的四个指令:
move(); //向前移一格;
turnLeft(); //向左转;
pcickBeeper(); //捡起方块;
putBeeper();//放下方块;
定义向右转
public void turnRight()
{
turnLeft();
turnLeft();
turnLeft();
}
向右转(循环)
//for循环
for(int i=0;i<3;i++)
{
turnLeft();
}
if-else
if(beepers present())
{
if(frontIscearl)
{
move();
}
}
else
{
putBeeper();
}