迷路全体で、ロボットがまだ交差点にないすべての交差点に物を置く(putThing)ようにしています。RobotSE にはブール値のメソッド isBesideThing() があり、これを使用しようとしています。ただし、コンパイルエラーが発生し続けます:
MazeIDudItz.java:24: cannot find symbol
symbol : method isBesideThing()
location: class MazeBot
if(!this.isBesideThing())
できることはすべて試しました。戻り値を含む public boolean method に変更しましたが、役に立ちませんでした。これが、RobotSE のクラス エクステンダです。これは私の最初のプログラミングクラスですので、私が不明確であるか、または私が言っていることが完全に意味をなさない場合は、事前に謝罪してください. そのエラーが表示されたとき、スペルを間違えた、何かを忘れた、または何かをインポートしなかったことを知っています。becker.robots.*; をインポートするだけでよいはずです。RobotSE はサブクラスであるためです。
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();
}
}
}
あなたの助けとアドバイスに感謝します!