Sorrow
01-26-05, 12:13 PM
Friend never did this, was like 5 months ago....had to dig it up, and so I'm going old school and posting it on forums for him to copy and paste :p
Delete this please in like 5min, thanks
__________________________________________________ ___
import kareltherobot.*;
import java.awt.Color;
class ChorMain implements Directions
{
public static void main(String [] args)
{
ChorBot Karel = new ChorBot(2, 4, North, 15);
Karel.leg();
}
static
{
World.reset();
World.showSpeedControl(true);
World.setVisible(true);
World.readWorld("H:\\Garden2.kwld");
}
}
__________________________________________________ _______
import kareltherobot.*;
public class ChorBot extends Robot
{
public ChorBot(int street, int avenue, Direction directions, int beepers)
{
super(street, avenue, directions, beepers);
}
private UrRobot A = new UrRobot(5,8,West,15);
private UrRobot B = new UrRobot(9,5,South,15);
private UrRobot C = new UrRobot(6, 1, East, 15);
public void turnRight()
{
for(int Z = 1; Z <= 3; Z++)
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
}
public void turnOff()
{
super.turnOff();
A.turnOff();
B.turnOff();
C.turnOff();
}
public void move()
{
super.move();
A.move();
B.move();
C.move();
}
public void pickBeeper()
{
super.pickBeeper();
A.pickBeeper();
B.pickBeeper();
C.pickBeeper();
}
public void putBeeper()
{
super.putBeeper();
A.putBeeper();
B.putBeeper();
C.putBeeper();
}
public void turnLeft()
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
public void turnAround()
{
for(int X = 1; X <= 2; X++)
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
}
public void leg()
{
while(frontIsClear())
{
putBeeper();
move();
}
turnLeft();
checkRight();
}
public void checkRight()
{
turnRight();
while(!frontIsClear())
{
putBeeper();
turnLeft();
move();
turnRight();
}
putBeeper();
turnOff();
}
public void harvestCorner()
{
pickBeeper();
}
}
Delete this please in like 5min, thanks
__________________________________________________ ___
import kareltherobot.*;
import java.awt.Color;
class ChorMain implements Directions
{
public static void main(String [] args)
{
ChorBot Karel = new ChorBot(2, 4, North, 15);
Karel.leg();
}
static
{
World.reset();
World.showSpeedControl(true);
World.setVisible(true);
World.readWorld("H:\\Garden2.kwld");
}
}
__________________________________________________ _______
import kareltherobot.*;
public class ChorBot extends Robot
{
public ChorBot(int street, int avenue, Direction directions, int beepers)
{
super(street, avenue, directions, beepers);
}
private UrRobot A = new UrRobot(5,8,West,15);
private UrRobot B = new UrRobot(9,5,South,15);
private UrRobot C = new UrRobot(6, 1, East, 15);
public void turnRight()
{
for(int Z = 1; Z <= 3; Z++)
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
}
public void turnOff()
{
super.turnOff();
A.turnOff();
B.turnOff();
C.turnOff();
}
public void move()
{
super.move();
A.move();
B.move();
C.move();
}
public void pickBeeper()
{
super.pickBeeper();
A.pickBeeper();
B.pickBeeper();
C.pickBeeper();
}
public void putBeeper()
{
super.putBeeper();
A.putBeeper();
B.putBeeper();
C.putBeeper();
}
public void turnLeft()
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
public void turnAround()
{
for(int X = 1; X <= 2; X++)
{
super.turnLeft();
A.turnLeft();
B.turnLeft();
C.turnLeft();
}
}
public void leg()
{
while(frontIsClear())
{
putBeeper();
move();
}
turnLeft();
checkRight();
}
public void checkRight()
{
turnRight();
while(!frontIsClear())
{
putBeeper();
turnLeft();
move();
turnRight();
}
putBeeper();
turnOff();
}
public void harvestCorner()
{
pickBeeper();
}
}