Squeak Program 3
Trapped in a Box
Fall 2005

  1. Open the "Bot Browser" window.

  2. Type in this new method for your mymethod category:

  3. Run the above method makeBox which takes no parameters. The box method takes 1 parameter, a Rectangle, but this is called from makeBox

  4. Define another method for the Bot to "follow" the interior edge of a box morph.
    The follow method has two parameters, n and aRectangle. n represents
    the number of times to move for the Bot. aRectangle represents the box morph:

  5. Run this new method from the Bot Workspace:
    | pica rectangle |
    pica := Bot new.
    rectangle := Rectangle center: pica center extent: 200@200.
    pica follow: 1000 borderOfBox: rectangle.
    

  6. Write a method to add an escape route for the Bot in a box.

  7. Write a new method for follow that allows more control over the angles turned by the Bot:

  8. Write a method go

  9. Run the Bot trying to get out of the box.

  10. ERASE THE RECTANGLE MORPHS and Save your image.
    This will save your methods with a clear screen.