hey guys im doing the gridworld case study and am at the part where i program the Zbug class
I have to try and write the code in a select case statement.
can you guys fix my code?
for more info:
page 14 on
i really need it fixed thanks a lot guys
import info.gridworld.actor.Bug;
import info.gridworld.grid.Location;
public class ZBug extends Bug
{
private int sideLength;
private int steps;
private int segment;
public ZBug(int length)
{
steps = 0;
segment = 1;
sideLength = length;
}
public void act()
{
switch (steps)
{
case 0:
case 2:
case 4:
if (steps < sideLength && canMove())
{
move();
steps++;
}
else if (segment == sideLength)
break;
case 1:
setDirection(Location.SOUTHWEST);
steps = 0;
segment++;
case 3:
setDirection(Location.EAST);
steps = 0;
segment++;
case 5:
if (canMove() == false)
break;
}
}
}