so, my assignment is to print out the adjacent empty space in gridworld when the bug makes moves..
here is my unfinished code:
public class PrintBug extends Bug
{
Grid gr = getGrid();
ArrayList<Location> locs = gr.getEmptyAdjacentLocations(getLocation…
private int steps ;
private int sidelength;
public PrintBug(int length)
{
steps = 0;
sidelength = length;
}
public void act()
{
if (steps < sidelength && canMove())
{
move();
steps++;
}
else
{
turn();
turn();
steps = 0;
}
this is what I have... and I'm stuck =(
please please help me... THANK YOU!

New Topic/Question
Reply


MultiQuote






|