GridWorld Code - Need Help
I'm writing a bug called HomerBug.
HomerBug is a subclass of Bug.
HomerBug chooses a DumbRainbowBug in the Grid.
If there are no DumbRainbowBugs, it does nothing.
Otherwise it takes one step closer to the DumbRainbowBug every step, plowing over everything in its path, until it kills the DumbRainbowBug.
I have already written DumbRainbowBug, essentially I need help establishing the location of 1 or all of the DumbRainbowBugs in the grid. I want to call the getLocation() method from DumbRainbowBug and use that location in HomerBug, but I can't seem to do it. Any and all help is appreciated, thanks.
Here is my fail code thus far:
public class HomerBug extends Bug
public void act()
//Location loc = new Location((DumbRainBowBug)DumbRainBowBug.getLocation());
//Location loc = new Location(DumbRainBowBug.getLocation());
//Location z = getLocation();
Re: GridWorld Code - Need Help
Isn't this one of the AP Comp Sci questions? If so, most people here won't be able to help you out until you give links to the relevant documentation (jdoc).