GRIDWORLD AP COMPUTER SCIENCE CASE STUDY STUDENT MANUAL

The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview: The next two lines create a Bug and a Rock, and add them to world. Once you run BugRunner. The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. Invoke the methods canMove , move and turn and be sure you understand what they do. Like the other programs we have seen, BugRunner defines a class that provides a main method.

Modify moveBug so that it invokes canMove and moves the bug only if it can. We’d like to know about it. Make a copy of BugRunner. An object is also called an instance because it is a member, or instance, of a class. An attribute is a piece of information about an object, like its color or location. Then you can access the predefined colors, like Color. Use the row number to control the red level and the column to control the blue.

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

Make a copy of BugRunner. The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. An attribute is a piece of information about an object, like its color or location.

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 grisworld.

  NAMESAKE ASHIMA ESSAY

gridworld ap computer science case study student manual

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. The first three lines are import statements; they list the gridwkrld from GridWorld used in this program.

GridWorld: Part 1

Are you using one of our books in a class? Color; Then you can access the predefined colors, like Color. Now you should be able to read Part 1 of the Student Manual and do the exercises. So you can get the x-coordinate of a Bug like this: The last line shows the world on the screen.

Write a method named makeBugs that takes an ActorWorld and an integer n and creates n bugs colored according to their location.

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

At shudent top of BugRunner. There are instructions here that might help: A modifier method changes an attribute of an object. The Location object you get from getLocation has methods named getRow and getCol that return integers. Modify randomBug to take an integer n and repeat n times. A class is a set of objects; every object belongs to a class.

gridworld ap computer science case study student manual

We’d like to know about it. Please consider filling out this short survey. The first line of main creates an ActorWorld object.

  BILLABONG SCHOOL BHOPAL HOLIDAY HOMEWORK FOR GRADE 2

A constructor is a special method that creates new objects. You can read the documentation at http: The next two lines create a Bug and a Rock, and add them to world.

Make a shudent bugs with different colors.

The result is a random walk, which you can read about at http: Like the other programs we have seen, BugRunner defines a class that provides a main method. GridWorld uses Color objects, which are defined studet a Java library. To get started, install GridWorld, which you can download from the College Board: UnboundedGrid; Now replace the line that creates the ActorWorld with this: Once you run BugRunner.

Modify moveBug so that it invokes canMove and moves the bug only if it can. An accessor method is a method that returns an attribute of an object.

To see a longer random walk, you can give ActorWorld a bigger stage. Invoke the methods canMovemove and turn and be sure you understand what they do.