java - What's my error? How can I fix it? -
Update: All the answers are needed to answer the question below. This is a special type of spiralbuger And my code and for spiralbug My real question is, what should I do to reset the bug to run again to run the bug? You are calling this method within yourself, causing one There is a stack overflow error. This is the wrong method, it should be in the Change it to: SpiralBug so I have not seen any example on the Internet; it uses
SpiralBug SpiralBug code but it has additionally, once it gets to a range of
BoundGrid and can not proceed now, to start again in the center of the grid, this is the place Where my problems start here is my code here is no error
Import info.gridworld.actor.ActorWorld; Import info.gridworld.grid.Location; Import java.awt.color; Public category spiralbugner (public static zero main) (string agre []) (ActorWorld world = new ActorWorld (); Spiralbug bug 1 = new spiralbug (0); world.add (new location (4, 4), bug 1); World.show ();}}
import info.gridworld.actor.bug; import info.gridworld.actor .actor; Import info info.gridworld.grid.Location; public class spiralbug bugs {private int side length; private int phase; public spiralbug (int n) {sideLength = n; phase = 0;} public zero act (if ( Dum & amp; lt; Side lang & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp;;);;;;; moves;; ;;;;;;;;;;;23; and feet ;;;;; b); turn (); phase = 0; sidelength ++;}} GetNameCol (), getGrid (). GetNumRows ()); moveTo (loc); side length = 0;}} pre>
to move public zero (location new location) {location public = new location (getGrid (). getNumCols (), getGrid (). getNumRows ()); MoveTo (loc); Side lanal = 0; }
move () method. The
conduction method takes a space and goes to that place, it should not be overridden.
Public Zero move (location new location) {location public = new location (getGrid (.) GetNumCols (), getGrid () .getNumRows ()); MoveTo (loc); Side length = 0; }
Comments
Post a Comment