Gridworld


In this exercise we’ll use OBJECTS and METHODS to make a world that contains bugs and flowers.


Before you start, you need to make sure that the gridworld.jar is in the build path of your Java project as follows:

Right click your Java project (ask your teacher if you do not know how to find this), then click Build Path. Configure Build Path, and make sure gridworld.jar is under the Libraries tab

If you cannot find it, ask your teacher to help you get it into your Java project.


First create a runner class for your program called Gridworld.


Now use this chart to help you complete the following challenges:

    1. Figure out how to get a World to show.

    2. Figure out how to add a Bug to the world (clue: you will need the Bug and Location objects)

    3. Add another bug at a random location in the world.

    4. Change the color of that bug to blue.

    5. Make the bug face to the right.

    6. Add flowers to the left and right of the bug.

    7. Fill the whole world with flowers!

    8. [Optional] Color the flowers in rows like the American flag (red & white)

    9. [Optional] Use a new class to make an X out of bugs.