/* Class and Method Declarations */
class Righty:ur_Robot
{ void turnRight();
};
void Righty::turnRight()
{ turnLeft();
turnLeft();
turnLeft();
}
/* Begin Task */
task
{ /* Declarations */
Righty Bigmomma (1, 5, North, 6);
Righty Dawg (1, 5, North, 0);
/* Statements */
Bigmomma.move();
Bigmomma.putBeeper();
Bigmomma.move();
Bigmomma.putBeeper();
Bigmomma.turnRight();
Bigmomma.putBeeper();
Bigmomma.move();
Bigmomma.putBeeper();
Bigmomma.turnLeft();
Bigmomma.move();
Bigmomma.putBeeper();
Bigmomma.move();
Bigmomma.putBeeper();
Bigmomma.move();
Bigmomma.turnLeft();
Bigmomma.move();
Bigmomma.move();
Bigmomma.turnLeft();
Bigmomma.move();
Bigmomma.move();
Bigmomma.move();
Dawg.move();
Dawg.pickBeeper();
Dawg.move();
Dawg.pickBeeper();
Dawg.pickBeeper();
Dawg.turnRight();
Dawg.move();
Dawg.pickBeeper();
Dawg.turnLeft();
Dawg.move();
Dawg.pickBeeper();
Dawg.move();
Dawg.pickBeeper();
Dawg.move();
Dawg.turnLeft();
Dawg.move();
Dawg.move();
Dawg.turnLeft();
Dawg.move();
Dawg.move();
}
/* End Task */
/* End Program */
--------------------------------------------------------------------------------
task
{ Robot Boo (7, 6, North, 10);
Boo.turnLeft();
Boo.turnLeft();
Boo.turnLeft();
if (Boo.frontIsClear())
{Boo.move();}
if (!Boo.nextToABeeper())
{Boo.putBeeper();}
else
{Boo.pickBeeper();}
if (Boo.frontIsClear())
{Boo.move();}
if (!Boo.nextToABeeper())
{Boo.putBeeper();}
else
{Boo.pickBeeper();}
if (Boo.frontIsClear())
{Boo.move();}
if (!Boo.nextToABeeper())
{Boo.putBeeper();}
else
{Boo.pickBeeper();}
if (Boo.frontIsClear())
{Boo.move();}
if (!Boo.nextToABeeper())
{Boo.putBeeper();}
else
{Boo.pickBeeper();}
if (Boo.frontIsClear())
{Boo.move();}
if (!Boo.nextToABeeper())
{Boo.putBeeper();}
else
{Boo.pickBeeper();}
if (Boo.frontIsClear())
{Boo.move();}
}
---------------------------------------------------------------------
task
{ Robot Ice (3, 5, North, 10);
//check north for wall
if (Ice.frontIsClear())
{Ice.move();}
else
{Ice.turnLeft();
//check west for wall
if (Ice.frontIsClear())
{Ice.move();}
else
{Ice.turnLeft();
//check south for wall
if (Ice.frontIsClear())
{Ice.move();}
else
{Ice.turnLeft();
//check east for wall
if (Ice.frontIsClear())
{Ice.move();}
else
{Ice.turnOff();
}
}
}
}
}
------------------------------------------------------------------
task
{
Robot Diter (10, 10, South, 120);
loop(9)
{
Diter.move();
Diter.putBeeper();
}
loop(2)
{Diter.turnLeft();
}
while (Diter.anyBeepersInBeeperBag())
{Diter.putBeeper();
}
Diter.move();
}
----------------------------------------------------------------------
task
{ /* Declarations */
Robot Boo (7, 6, North, 10);
Robot Lean (7, 11, West, 10);
/* Statements */
Boo.turnLeft();
Boo.turnLeft();
Boo.turnLeft();
if (Boo.frontIsClear())
{ Boo.move();}
if (Lean.nextToABeeper())
{ Lean.pickBeeper();}
else
{ Lean.putBeeper();}
if (Boo.nextToABeeper())
{ Boo.pickBeeper();}
else
{ Boo.putBeeper();}
if (Lean.frontIsClear())
{ Lean.move();}
if (Boo.frontIsClear())
{ Boo.move();}
if (Lean.nextToABeeper())
{ Lean.pickBeeper();}
else
{ Lean.putBeeper();}
if (Boo.nextToABeeper())
{ Boo.pickBeeper();}
else
{ Boo.putBeeper();}
if (Lean.frontIsClear())
{ Lean.move();}
if (Boo.frontIsClear())
{ Boo.move();}
if (Lean.nextToABeeper())
{ Lean.pickBeeper();}
else
{ Lean.putBeeper();}
if (Boo.nextToABeeper())
{ Boo.pickBeeper();}
else
{ Boo.putBeeper();}
if (Boo.frontIsClear())
{ Boo.move();}
if (Lean.frontIsClear())
{ Lean.move();}
if (Boo.nextToABeeper())
{ Boo.pickBeeper();}
else
{ Boo.putBeeper();}
if (Lean.nextToABeeper())
{ Lean.pickBeeper();}
else
{ Lean.putBeeper();}
if (Boo.frontIsClear())
{ Boo.move();}
if (Lean.frontIsClear())
{ Lean.move();}
if (Boo.nextToABeeper())
{ Boo.pickBeeper();}
else
{ Boo.putBeeper();}
if (Lean.nextToABeeper())
{ Lean.pickBeeper();}
else
{ Lean.putBeeper();}
if (Lean.frontIsClear())
{ Lean.move();}
}
--------------------------------------------------
/* Class and Method Declarations */
class wingsLose:ur_Robot
{
void turnRight();
void drawHead();
void longLine();
void shortLine();
};
void wingsLose::turnRight()
{ turnLeft();
turnLeft();
turnLeft();
}
void wingsLose::drawHead()
{ move();
move();
putBeeper();
move();
putBeeper();
move();
turnRight();
move();
putBeeper();
move();
putBeeper();
move();
turnRight();
move();
putBeeper();
move();
putBeeper();
move();
turnRight();
move();
putBeeper();
move();
putBeeper();
move();
}
void wingsLose::longLine()
{ move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
}
void wingsLose::shortLine()
{ move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
}
task
{ /* Declarations */
wingsLose Ian (9, 5, North, 500);
/* Statements */
Ian.drawHead();
Ian.turnLeft();
Ian.move();
Ian.turnLeft();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.turnLeft();
Ian.drawHead();
Ian.turnRight();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.turnLeft();
Ian.move();
Ian.turnRight();
Ian.move();
Ian.turnRight();
Ian.shortLine();
Ian.turnLeft();
Ian.turnLeft();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.shortLine();
Ian.turnLeft();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.move();
Ian.turnLeft();
Ian.longLine();
Ian.turnRight();
Ian.move();
Ian.turnRight();
Ian.shortLine();
}
/* End Task */
/* End Program */
-------------------------------------------------------
class emptier: Robot
{
void emptybag();
void excape();
};
void emptier::emptybag()
{ if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();}
if (Screech.anyBeepersInBeeperBag())
{Screech.putBeeper();
}
void emptier::excape()
{
Screech.turnLeft();
Screech.turnLeft();
Screech.move();
Screech.move();
Screech.move();
Screech.move();
Screech.move();
}
task
{
Robot Zack (7, 9, North, 0);
emptier Screech (7, 5, East, 10);
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
if (Screech.nextToARobot())
{Screech.emptybag();}
else
{Screech.excape();}
Screech.move();
}
-----------------------------------------------------
/* Class and Method Declarations */
class maze:Robot
{
void turnRight();
};
void maze::turnRight()
{ turnLeft();
turnLeft();
turnLeft();
}
task
{ /* Declarations */
maze Ian (7, 5, West, 10);
/* Statements */
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();
}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
if (Ian.frontIsClear())
{Ian.move();}
else
{Ian.turnRight();
Ian.move();}
if (!Ian.nextToABeeper())
{Ian.putBeeper();}
else
{Ian.pickBeeper();}
}
-------------------------------------------------------------------------
/* Class and Method Declarations */
class LineDrawer:ur_Robot
{
void ShortLine();
void LongLine();
void turnRight();
void ShortDiagLine
void LongDiagLine
};
void LineDrawer::ShortLine()
{ move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
}
void LineDrawer::turnRight()
{ turnLeft();
turnLeft();
turnLeft();
}
void LineDrawer::LongLine()
{ move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
move();
putBeeper();
}
void LineDrawer::ShortDiagLine
{ move();
putBeeper();
turnLeft();
move();
putBeeper();
turnRight();
move();
putBeeper();
turnLeft();
move();
}
void Line Drawer::LongDiagLine
{ move();
putBeeper();
turnLeft();
move();
putBeeper();
turnRight();
move();
putBeeper();
turnLeft();
move();
putBeeper();
turnLeft();
move();
putBeeper();
turnRight();
move();
putBeeper();
turnLeft();
move();
}
class LineSweeper:ur_Robot
{
void ShortLineSweep();
void LongLineSweep();
void turnRight1();
void LongDiagSweep();
void ShortDiagSweep();
};
void LineSweeper::ShortLineSweep()
{ move();
pickBeeper();
move();
pickBeeper();
move();
pickBeeper();
}
void LineSweeper::LongLineSweep()
{ move();
pickBeeper();
move();
pickBeeper();
move();
pickBeeper();
move();
pickBeeper();
move();
pickBeeper();
move();
pickBeeper();
}
void LineSweeper::turnRight1()
{ turnLeft();
turnLeft();
turnLeft();
}
task
{ /* Declarations */
LineDrawer Drawa (4, 6, North, 500);
LineSweeper Sweepa (1, 1, East, 500);
/* Statements */
Drawa.LongLine();
Drawa.move();
Drawa.turnRight();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.turnRight();
Drawa.LongLine();
Drawa.turnLeft();
Drawa.turnLeft();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.turnRight();
Drawa.ShortLine();
Drawa.turnRight();
Drawa.ShortLine();
Drawa.turnRight();
Drawa.move();
Drawa.putBeeper();
Drawa.move();
Drawa.putBeeper();
Drawa.turnRight();
Drawa.turnLeft();
Drawa.turnLeft();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Drawa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.turnLeft();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.LongLineSweep();
Sweepa.move();
Sweepa.turnRight1();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.turnRight1();
Sweepa.LongLineSweep();
Sweepa.turnLeft();
Sweepa.turnLeft();
Sweepa.move();
Sweepa.move();
Sweepa.turnRight1();
Sweepa.ShortLineSweep();
Sweepa.turnLeft();
Sweepa.ShortLineSweep();
Sweepa.turnLeft();
Sweepa.move();
Sweepa.pickBeeper();
Sweepa.move();
Sweepa.pickBeeper();
Sweepa.turnLeft();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.move();
Sweepa.turnLeft();
Sweepa.move();
Sweepa.turnLeft();
Sweepa.move();
}
/* End Task */
/* End Program */
-------------------------------------------------