CS111

TurtleWorld Contract

An instance of the TurtleWorld class represents a world that may be inhabited by turtles.

TurtleWorld programs are specified by declaring subclasses of TurtleWorld that override the default (do-nothing) run method. This method will be executed when the Run button is pressed in an instance of TurtleWorld.

Instance Methods

public void run ()
Execute specified turtle actions in this turtle world.

Class Methods

public static void runAsApplication (final TurtleWorld applet, final String name)
Run TurtleWorld applet as a stand-alone Java application within a window with name name. TurtleWorld applets are often easier to test and debug as applications. Many systems require a browser to view applets, and the applet-caching behavior of many browsers makes it necessary to quit and restart a browser every time an edit to an applet is made.