not sure how to turn this into a AI class. i have been trying to use int distanceToClosetFrontObject();
public class RandomMower extends Mower
{
private int state=0;
/**
* Act - do whatever the AIMower wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
switch (state)
{
case 0:
throttleUp();
state=1;
break;
case 1:
if (bumpSensor()==true)
{
turnLeft(15);
}
else
{
switch (Greenfoot.getRandomNumber(5))
{
case 0:
turnLeft(Greenfoot.getRandomNumber(2)*15);
break;
case 1:
turnRight(Greenfoot.getRandomNumber(2)*15);
break;
}
}
state=1;
break;
}
// Call the Mower.act() method
super.act();
}
}