This essentially comprises an actual laboratory exercise. You will not have to turn most of this in, but you will need to show evidence that you did it. If you don’t do this then you will be totally lost when we do more advanced work with the Grid World which you will have to turn in.
There is ONE exercise you must do, and you will have to turn in called “Bee Critter” which is the last problem listed in this post.
With that introduction, here you go….
1. Here is the Grid World Student Manual.
Please don’t print it out - it’s not worth it.
2. Notice that I’ve added the Grid World API documentation to the sidebar on the right.
3. Download the Grid World Code and unzip it.
This is a slightly modified version of the code that comes from the College Board. I modified it so that the sample projects are actually BlueJ projects that will work without modifying your blueJ setup. We’ll talk more about what’s in here at a later time - feel free to explore on your own though.
4. Open the blueJ project called “firstproejct” which can be found in GridWorldCode->projects->firstproject. Compile it and …
STUFF YOU HAVE TO DO:
(Note: when I say “read” below I mean read what you need to. I would recommend first looking at what you have to do and then looking through the reading to find answers to your questions. If you’re the kind of person who likes to read from front to back, then by all means, do that.)
1. You’re now ready to begin READING (YEA!) Part I of the student manual. Do take the time to mess around with the stuff that’s introduced in Part 1.
2. Read part 2 - it refers to “BoxBug” project which can be found in the same folder as the firstproject. As you read at least think about the “Do you know?” questions as you go through it.
DO EXERCISES: 2, 4
3. Read Part 3 and DO the “group activity” - writing the Jumper class and JumperRunner - on your own. There is no example project for this one. You can either make a new project (make sure to include a +Libs folder with gridworld.jar file in it) or just write it into the last project your had working.
Read the “What makes it run?” section at the end of part 3.
4. Read Part 4 CAREFULLY. Critters are sophisticated little buggers and the AP folks love to use them to test your proficiency and facility with Polymorphism.
Many of the examples and exercises in part 4 refer to code that’s written in the text or in an appendix. You should be able to copy/paste this code into a project without too much difficulty. You can write the code for these exercises into a new project or an existing one — you just have to import the right stuff to get it to work.
4.1 In part 4 they give the code for CrabCritter, but it would be a good exercise to try to produce it yourself - or even re-produce after looking at the code in the PDF.
DO: Exercises 1 or 2, and exercise 6.
Also DO this problem (this one you will have to turn in):
A Bee is an actor that acts as follows. First the Bee makes all the Flowers in the neighboring locations brighten their color. After that, the Bee moves to a randomly picked neighboring location that contains a Flower or, if no adjacent Flowers have been found, to a randomly picked empty neighboring location. If there is nowhere to move, the Bee stays in its current Location. If the Bee moves onto a Flower, it saves that Flower and restores the same Flower when it moves away from that location.
You should implment the Bee by extending Critter.
Posted on March 3rd, 2009 by Baker Franke
Filed under: Labs | No Comments »