Throughout a maze, I am trying to have my robot put a thing down(putThing) every intersection where one is not already at. RobotSE has the boolean method, isBesideThing(), which I am attempting to use. However, I keep getting the compiling error:
MazeIDudItz.java:24: cannot find symbol
symbol : method isBesideThing()
location: class MazeBot
if(!this.isBesideThing())
I have tried everything that I know how to do. I changed it to a public boolean method ,containing a return value, with no avail. Here is my class extender for RobotSE. This is my first programming class so my apologies ahead of time if I am unclear or what I say does not completely make sense. I know that when I get that error I misspelled something, forgot something, or did not import something. I should only have to import becker.robots.*; since RobotSE is a sub class.
class MazeBot extends RobotSE
{
public MazeBot(City theCity, int str, int ave, Direction dir, int numThings)
{
super(theCity, str, ave, dir, numThings);
}
private boolean isAtEndSpot()
{
return (this.getAvenue() == 9 && this.getStreet() == 10);
}
public void dontPickThatUp()
{
while(!this.isBesideThing())
{
this.putThing();
}
}
public void moveCheck()
{
if(this.frontIsClear())
{
this.move();
}
else
{
this.turnAround();
}
}
public void checkRight()
{
this.turnRight();
if (this.frontIsClear())
{
this.moveCheck();
}
else
{
this.turnLeft();
this.moveCheck();
}
}
public void NavigateMaze()
{
while (!this.isAtEndSpot())
{
this.checkRight();
}
}
}
I appreciate your help and advice!
I'd say to read their documentation thoroughly.
The method signature is
public boolean isBesideThing(IPredicate kindOfThing)
So you have to match the signature and pass an IPredicate
.