这是我正在尝试使用的代码(在 Mac 上):
import info.gridworld.actor.Bug;
/**
* A <code>BoxBug</code> traces out a square "box" of a given size. <br />
* The implementation of this class is testable on the AP CS A and AB exams.
*/
public class BoxBug extends Bug
{
private int steps;
private int sideLength;
/**
* Constructs a box bug that traces a square of a given side length
* @param length the side length
*/
public BoxBug(int length)
{
steps = 0;
sideLength = length;
}
/**
* Moves to the next location of the square.
*/
public void act()
{
if (steps < sideLength && canMove())
{
move();
steps++;
}
else
{
turn();
turn();
steps = 0;
}
}
}
当我单击侧面的错误三角形时,它一直告诉我找不到“附加源”。我不知道该怎么办。