GRIDWORLD AP COMPUTER SCIENCE CASE STUDY STUDENT MANUAL

Modify moveBug so that it takes an integer, n , as a parameter, and moves the bug n times if it can. Modify randomBug to take an integer n and repeat n times. Then write a method named colorBug that takes a Bug as a parameter, reads its location, and sets the color. To see a longer random walk, you can give ActorWorld a bigger stage. A constructor is a special method that creates new objects.

There are instructions here that might help: Test your method by calling it from main. Then write a method named colorBug that takes a Bug as a parameter, reads its location, and sets the color. An attribute is a piece of information about an object, like its color or location. You should be able to run your random walk for a few thousand steps you might have to use the scrollbars to find the Bug. Then you can access the predefined colors, like Color. The first three lines are import statements; they list the classes from GridWorld used in this program.

Invoke the methods canMovemove gfidworld turn and be sure you understand what they do. A modifier method changes an attribute of an object. Now you should be able to read Part 1 of the Student Manual and do the exercises.

GRIDWORLD CASE STUDY MANUAL IN PREPARATION FOR THE AP COMPUTER SCIENCE EXAMINATION

You can read the documentation at http: To ccomputer a longer random walk, you can give ActorWorld a bigger stage. Modify randomBug to take an integer n and repeat n times.

  PATRICK CAMANGIAN DISSERTATION

gridworld ap computer science case study student manual

The next two lines create a Bug and a Rock, and add them to world. A class is a set of objects; every object belongs to a manula.

Make a few bugs with different colors. Write a method named makeBugs that takes an ActorWorld and an integer n and creates n bugs colored according to their stuent.

GRIDWORLD CASE STUDY MANUAL IN PREPARATION FOR THE AP COMPUTER SCIENCE EXAMINATION

The result is a random walk, which you can read about at http: At the top of BugRunner. An accessor method is a method that returns an attribute of an object.

Please consider filling out this short survey.

The Location object you get from getLocation has methods named getRow and getCol that return integers. Make a copy of BugRunner.

Modify moveBug so that it invokes canMove and moves the bug only if it can. The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. GridWorld uses Color objects, which are defined in a Java library. A constructor is a special method that creates new objects. There are instructions here that might help: An object is also called an instance because it is a member, or instance, of a class. We’d like to know about it.

  ESSAY HOLIDAY AT PULAU PANGKOR

The first line of main creates an ActorWorld object. Are you using one of our books in a class? So you can get the x-coordinate of a Bug like this: You can find the documentation for these classes at http: The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview: Then write a method named colorBug that takes a Bug as a parameter, reads its location, and sets the color.

gridworld ap computer science case study student manual

Color; Then you can access the predefined colors, like Color. To get started, install GridWorld, which you can download from the College Board: Modify scince so that it takes an integer, nas a parameter, and moves the bug n times if it can. Use the row number to control the red level and the column to control the blue. The last line shows the world maanual the screen. UnboundedGrid; Now replace the line that creates the ActorWorld with this:

Author: admin