GRIDWORLD AP COMPUTER SCIENCE CASE STUDY STUDENT MANUAL

To create Bugs with different colors, we have to import Color: Make a few bugs with different colors. Test your method by calling it from main. 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. An accessor method is a method that returns an attribute of an object. The first line of main creates an ActorWorld object.

Test your method by calling it from main. UnboundedGrid; Now replace the line that creates the ActorWorld with this: The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. At the top of BugRunner. The first three lines are import statements; they list the classes from GridWorld used in this program.

A constructor is a special method that creates new objects. Invoke the methods canMovemove and turn and be sure you understand what they do.

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

Make a copy of BugRunner. Then you can access the predefined colors, like Color. Are you using one of our books in a class?

A modifier method changes an attribute of an object. To see a longer random walk, you can give ActorWorld a bigger stage. To create Bugs with different colors, we have to import Color: Write a method named makeBugs that takes an ActorWorld and an integer n and creates n bugs colored according to their location. Modify moveBug so that it invokes csae and moves the bug only if it can.

  GD GOENKA DWARKA HOLIDAY HOMEWORK 2014-15

Like the other programs we have seen, BugRunner defines a class that provides a main method. An object is also called an instance because it is a member, or instance, of a class. There are stkdent here that might help: Make a few bugs with different colors. So you can get the x-coordinate of a Bug like this: You sutdent be able to run your random walk for a few thousand steps you might have to use the scrollbars to find the Bug.

To get started, install GridWorld, which you can download from the College Board: Please consider filling out this griddorld survey. The Location object you get from getLocation has methods named getRow and getCol that return integers. An attribute is a piece of information about an object, like its color or location.

gridworld ap computer science case study student manual

At the top of BugRunner. GridWorld uses Color objects, which are defined in a Java library.

gridworld ap computer science case study student manual

The next two lines create a Bug and a Rock, and add them to world. The result is a random walk, which you can read about at http: We’d like to know about it.

  OCR F292 CASE STUDY 2015

Once you run BugRunner. Modify moveBug 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 gridwotld to control the blue. An accessor method is a method that returns an attribute of an object.

gridworld ap computer science case study student manual

You can find the documentation for these classes at http: Now you should be able to read Part 1 of the Student Scienfe and do the exercises. The last line shows the world on the screen.

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

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. A class is a set of objects; sciencce object belongs to a class. The first three lines are import statements; they list the classes from GridWorld used in this program.