User Tools

Site Tools


Robot Olympics

Karel is practicing for the Robot Olympics. One of karel's events is the shuttle race. The shuttle race requires karel to move around two beepers in a figure 8 pattern. Write a program that instructs karel to walk a figure 8 pattern with as few instructions as possible. Karel must stop in the same place as it starts and must be facing the same direction.

import java.awt.Color;
import kareltherobot.*;
public class Olympics implements Directions 
    public static void main(String[] args)
    	World.setSize(6, 4);
    	World.placeBeepers(4, 2, 1);
    	World.placeBeepers(2, 2, 1);  	
    public static void task()
    	Robot karel = new Robot(1,2,North,0);
      // Your code here

API (Application Programming Interface)

robot_olympics.txt · Last modified: 2019/08/18 12:41 by frchris