SA-1, due Mar 31

Make a blob that wanders a little more purposefully than the one from class, walking in a straight line for a fixed number of steps before switching. E.g., every 10 steps it picks a random new dx and dy, instead of doing that every step like Wanderer.

Exercises

You can mostly follow the structure of Wanderer, though when you're reviewing later, you might try doing this from a clean slate.

  1. Define a new subclass of Blob; you can choose the name.
  2. Give it instance variables indicating the number of steps between velocity changes, and how many of those it has currently gone since the last change.
  3. Define a constructor that takes initial x and y values and invokes the super constructor with them. The constructor should also set the number of steps between velocity changes, to be a random number between 10 and 20.
  4. Override the step method so that random new values are assigned to dx and dy each time the required number of steps has been taken.
  5. Modify the BlobGUI to allow creation of an instance of your class.

Submission Instructions

Turn in your completed Java code.