APCS Unit 9: Gridworld Case Study

Applying our CS knowledge to a complete program

GRIDWORLD CASE STUDY OVERVIEW

Now that we’ve covered all the main topics in AP Computer Science, it’s time to put our knowledge to the test!  To do this, we’ll look at something called the Gridworld Case Study.  This is a complete, professionally made program that includes a simple graphic interface (kind of like Jeroo), but will also give us complete access to the code used to make it.  In doing so, we have the power to edit the program and make it do what we want!  It ends up being a whole lot of fun.  In the end, you’ll get to do the following:

  1. Learn how to make simple bugs in Gridworld, and use the API of simple bug methods to tell the bugs how to interact with their environment
  2. Use different methods to solve simple logic problems with your bugs.  These logic problems will showcase the different methods available to your bugs and critters!
  3. Investigate how a professionally designed program like Gridworld uses inheritance and polymorphism to aid its design.

When you’re done, you’ll have all the tools it takes to work in the Gridworld!

PART 1: GRIDWORLD BUGS

(30 pts)  About 3 days

The beginning of this unit has you learn the ins-and-outs of making bugs, telling bugs what to do, and making them interact with their world in simple ways.  You’ll follow some tutorials to get your Gridworld up-and-running in BlueJ and then see what you can make happen!

PART 2: GRIDWORLD CHALLENGES

(30 pts)  About 3 days

The second part of the unit has you complete a few challenges within the Gridworld itself.  These challenges will help you practice making bugs of your own design as you try to tackle a few fun challenges.

PART 3: GRIDWORLD DESIGN

(20 pts)  About 3 days

Finally, we’ll get to look at the Gridworld design in more detail as we explore how Gridworld works with various classes and interfaces.  You’ll also make bugs that can interact with other bugs in new ways.

PART 1: Gridworld Bugs

Getting started in Gridworld

Gridworld is a program that has a graphical interface similar in some ways to Jeroo (things move not he screen), but will let you actually go in and edit the code to do what you want!  This can be as simple as making a bug that travels in a square, spiral, or zig-zag pattern, or as complex as having user-controls, AI decision making, or custom icons/graphics.  It can be as simple or as complex as you want!

To get started, you first need to get Gridworld working with your BlueJ.  This is a 4-step process (and there’s a video):

  1. DOWNLOAD the GridworldCode file and unzip the inner files into a new file on the desktop of your computer.
  2. Open BlueJ and go the Preferences->Library tab.  Add the “gridworld.jar” file you just unzipped as a new library.
  3. From within BlueJ, choose “open” and navigate to the Projects -> FirstProjects -> BugRunner.java file
  4. Compile this program and confirm that the Gridworld opens

Getting Gridworld working the first time is the hard part.  After that, everything is pretty straight-forward.  Now, follow the tutorial videos to complete “Gridworld Assignment 1” and “Gridworld Assignment 2”!

GRADING & PROCESS

 Follow the instructions to get the first Gridworld open on your screen.  There should be a bug that moves when you run the simulation.

 Watch the three presentations on Gridworld as you look through the different menus and options.  Take a full page of notes on Gridworld and what it can do for you!

Complete Gridworld Assignment 1

 Complete Gridworld Assignment 2

 Have Benshoof confirm your working programs!

Gridworld Intro Part 1

Gridworld Part 2

Gridworld Part 3

What’s Due In Gridworld Case Study Part 1: Gridworld Bugs

  • Inheritance Notes
  • 6 Inheritance Java Tasks
  • Benshoof’s Check-Off

Here’s what’s due in Part 1: Gridworld Bugs

  1.  Take a page of notes on Inheritance, including details on the keywords “extends” and “super”
  2. Complete all 6 Inheritance Tasks in Java
  3.  Have Benshoof check-off your working programs

PART 2: Gridworld Design

Exploring interactions between actors in Gridworld

The next part of our unit is all about how classes (Bugs) can interact with each other within Gridworld!  Here you’ll work through the next two Gridworld assignments as you learn how the different classes and interfaces work together. Take good notes on your obesrvations, as well as on the concepts presented in the three presentations below.

GRADING & PROCESS

 Take a full page of notes on the ideas from the three presentations about the Gridworld Assignments.  Add to your thoughts and notes as you work through the next two Gridworld Assignments!

 Complete Gridworld Assignment 3

 Complete Gridworld Assignment 4 

Assignment 3 Insights

Assignment 4 Thoughts

More Thoughts on Assignment 4

What’s Due In Gridworld Part 2: Gridworld Design

  • Notes on Implementation
  • 6 Array Tasks
  • Benshoof’s Check-Off

Here’s what’s due in Part 2: Gridworld Design

  1.  Take a full page of notes on Gridworld interactions as well as on your observations while working
  2.  Complete Gridworld Assignment 3
  3.  Complete Gridworld Assignment 4
  4.  Have Benshoof check-off your working programs!

PART 3: Langton's Ant

Create a working simulation of basic ant behavior in Gridworld!

Welcome to the third part of the unit!  Here you get to use Gridworld to produce a very cool – and well known – computer science simulation:  Langton’s Ant!  Your job in this part is relatively simple: use Gridworld to create a bug called LangtonAnt that moves and works as described in the Langton Ant videos.  This should be a relatively simple set of instructions (though not a totally simple program).

Langton’s Ant Introduction

Langton’s Ant

More Langton’s Ant Ideas

What’s Due In GridWorld Part 3: Langton’s Ant

  • Langton’s Ant Notes
  • LangtonAnt
  • Benshoof’s Check-Off

Here’s what’s due in Part 3: Langton’s Ant

  1. Take some notes on Langton’s Ant and brainstorm how you could make that same system work in Gridworld!
  2.  Make LangtonAnt – a new class that extends Bug – in Gridworld and get it working properly!
  3.  Have Benshoof check-off your finished, working LangtonAnt

Double Check: Unit Expectations

Check what you need to have completed by the unit deadline
The purpose of this unit is to use the Engineering Design Process to wire, design, and build a working Bug Bot.  You should have had the chance to do some soldering, design your own Bug Bot, and use the tools in our makerspace to build your Bug Bot.  If you were really on-task and working hard, you should have also had time to decorate your Bug Bot to make it look super cool.  By the unit deadline, you should have completed and be able to submit the following items:

Engineering Notebook:

 (Part 1) Definition of problem, criteria, constraints, and Bug Bot Overview notes

 (Part 1) Wiring diagram, soldering notes, and wiring reflection

 (Part 2) Bug Bot Design brainstorm, notes, and careful drawing

 (Part 3) Final drawing/picture, half-page written reflection on Bug Bots

Building & Making:

 (Part 1) Wiring should work, soldering should be clean and complete

 (Part 2) Bug Bot design should be carefully drawn out including labels and diagrams

 (Part 3) The Bug Bot should be assembled and should function properly

Benshoof Checkpoints

 (Part 1) Benshoof should have seen your working wiring before you moved on

 (Part 2) Benshoof should have seen your careful drawing before you moved on

 (Part 3) Benshoof should have seen your working Bug Bot