//Name David Willmore Date 8 Dec. 2011 import edu.pace.World; import edu.pace.

Robot; import javax.swing.JOptionPane; public class Lab06 { public static void main(String[] args) { String filename = JOptionPane.showInputDialog("What robot world?"); World.readWorld(filename); World.setSize(10, 10); World.setSpeed(10); task_01(); task_02(); task_03(); task_04(); task_05(); task_06(); //go //go //go //go //go //go to to to to to to the the the the the the end of the beeper wall wall, pick wall, pick end of the row of beepers

up all the beepers (max one per pile) up all the beepers row of beepers, there is one gap

} public static void task_01() { //go to the end of the row of Robot temp = new Robot(1, 1, while(temp.nextToABeeper()) { temp.move(); } } public static void task_02() { //go to the beeper Robot temp = new Robot(1, 2, for(int k=0; k<10; k++) { if(temp.nextToABeeper()) { } else { temp.move(); } } } public static void task_03() { //go to the wall Robot temp = new Robot(1, 3, while(temp.frontIsClear()) { temp.move(); } // while } // task_03 public static void task_04() { //go to the wall, pick up all Robot temp = new Robot(1, 4, while(temp.frontIsClear()) if(temp.nextToABeeper())

beepers World.EAST, 0);

World.EAST, 0);

World.EAST, 0);

the beepers (max one per pile) World.EAST, 0);

{ temp.pickBeeper(); temp.move(); } else { temp.move(); } } public static void task_05() { //go to the wall, pick up all Robot temp = new Robot(1, 5, while(temp.frontIsClear()) { if(temp.nextToABeeper()) { temp.pickBeeper(); } else { temp.move(); } } } public static void task_06() { //go to the end of the row of Robot temp = new Robot(1, 6, while(temp.frontIsClear()) if(temp.nextToABeeper()) { temp.move(); temp.move(); } else { } } }

the beepers World.EAST, 0);

beepers, there is one gap World.EAST, 0);

World tasks1

World tasks2

World tasks 3

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times