APCS Unit 9
Gridworld

This unit is all about bringing together the many ideas from our course into a complete program.  Here we get to work with something called Gridworld: a professionally designed program (with AP Computer Science in mind) that lets us control the movement and interaction of various elements within a 2-Dimensional grid-based world.  It’s a lot like Jeroo, but if we had more control over everything in Jeroo. As we work through this you’ll learn how to:

  • Create your own things (Bugs) within gridworld by simply extending existing classes
  • Use different ways of storing information to create bugs that can do what you need them to do
  • Solve problems using Gridworld

The unit is broken up into four (very short) parts.  Each part has its own handout that walks you through the ins-and-outs of Gridworld mechanics

  1. Part 1: Getting around in Gridworld
  2. Part 2: Making bugs of your own design
  3. Part 3: Working with locations and the grid
  4. Part 4: Making bugs & critters interact with each other

When you’re done, you’ll have a good sense of what Gridworld can do for you.  If you want to use it in the future for 2D graphics, it can be a great tool!

The first part of this unit is all about getting Gridworld running on your computer and connected to BlueJ. It’s a relatively simple process, but you want to get it taken care of quickly so you can spend most of your time looking through the different options.  

Start by downloading the Gridworld files through the link at the left and dragging the internal folder to your desktop.  Then in BlueJ you need to add the gridworld.jar file to your library. When you restart BlueJ you should be all set. The way to double check is to drag the BugRunner class into your BlueJ project and run it.  It should run and move on its own.

Then, work through the Part 1 activity to see how some of the parts work!

GRADING & PROCESS

 Download & Install Gridworld on your computer and add the library to BlueJ

 Watch the video on using Gridworld and start a page of notes on how to use the basics of Gridworld

 Complete the “Do You Know Set 1” questions in your engineering notebook

 Complete the “Exercise” questions in your engineering notebook

 

Next up are bug variations!  It’s easy to make your own bugs by simply extending the Bug class and overriding the act method (or a different method if you’re trying to make something special happen).  Here in part 2 you’ll follow the Part 2: Bug Variations activity to complete a few questions and then make a few different bugs that do different things.

GRADING & PROCESS

 Watch the video on Gridworld Part 2 concepts and start a page of notes!

 Complete the “Do You Know Set 2” questions in your engineering notebook

 Complete Gridworld Challenge 2: CircleBug

 Complete Gridworld Challenge 3: SpiralBug

 Complete Gridworld Challenge 4: ZBug

 Complete Gridworld Challenge 5: DancingBug

The third part of this unit has us look at some of the trickier classes and interfaces that Gridworld uses to create class interactions.  In particular, we look at how the Location class defines the location of every bug, flower, and rock in the gridworld. We also look at the Grid interface to understand that every object must live in a grid, and we need to be able to talk to the grid if we want to talk to the things that live in it.  Finally we look at the Actor class to acknowledge that things like Flowers, Rocks, Bugs, and Critters all extend Actor. Then we take advantage of these things to make a cool program, the Jumper bug.

GRADING & PROCESS

 Watch the video on Gridworld Part 3 concepts and start a page of notes!

 Complete the “Do You Know Sets 3,4,5,6” questions in your engineering notebook

 Work with a partner (if you want) to complete the Gridworld Challenge 6: Jumper

The final part of our unit has us create actors that can interact with other actors.  This requires that your Critters be able to talk to the grid and the locations of other actors.  Doing so lets you give commands (methods) to other Actors. As you get more and more comfortable with this interaction, you’ll be able to do cooler and cooler things within Gridworld.

If you’re thinking you’ll want to use Gridworld to make 2D graphics for your 4th quarter project, then these are the skills you’ll have to master.

GRADING & PROCESS

 Watch the video on Gridworld Part 4 concepts and start a page of notes!

 Complete the “Do You Know Sets 7,8,9” questions in your engineering notebook

 Complete Gridworld Challenge 7: ChameleonCritterDarken

 Choose and complete 3 more Gridworld Challenge 7 challenges!

Gridworld Part 4 (A)

Gridworld Part 4 (B)

APCS Unit 9 Map
Looking for something?  Here you'll find a library of links to all the documents, images, and videos needed here in APCS Unit 9.