GRIDWORLD AP COMPUTER SCIENCE CASE STUDY STUDENT MANUAL

The last line shows the world on the screen. Modify randomBug to take an integer n and repeat n times. Like the other programs we have seen, BugRunner defines a class that provides a main method. Modify moveBug so that it takes an integer, n , as a parameter, and moves the bug n times if it can. To create Bugs with different colors, we have to import Color: To see a longer random walk, you can give ActorWorld a bigger stage.

The first line of main creates an ActorWorld object. Modify randomBug to take an integer n and repeat n times. The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. Then you can access the predefined colors, like Color. The Location object you get from getLocation has methods named getRow and getCol that return integers. We’d like to know about it. Color; Then you can access the predefined colors, like Color.

gridworld ap computer science case study student manual

The Location object you get from getLocation has methods named getRow and getCol that return integers. There are instructions here that might help: Like the other programs we have seen, BugRunner defines a class that provides a main method.

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

Please consider filling out this short survey. An object is also called an instance because it is a member, or instance, of a class. An accessor method is a method that returns an attribute of an object.

  RYAN INTERNATIONAL SCHOOL INDORE HOMEWORK

Write a method named makeBugs that takes an ActorWorld and an integer n and creates n bugs colored according to their location. The first line of main creates an ActorWorld object. GridWorld uses Color objects, which are defined in a Java library. At the top of BugRunner.

GridWorld: Part 1

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. We’d like to know about it.

A class is a set of objects; every object belongs to a class. The result is a random walk, which you can read about at http: Color; Then you can access the predefined colors, like Color. An attribute is a piece of information about an object, like its color or location.

gridworld ap computer science case study student manual

To see a longer random walk, you can give ActorWorld a bigger stage. Now you should be able to read Part 1 of the Student Manual and do the exercises. Modify moveBug so that it invokes canMove and moves the bug only if it can. The Student Manual uses vocabulary I have scienec presented yet, so to get you started, here is a quick preview: Are you manuaal one of our books in a class?

  GCSE PHYSICS COURSEWORK SOLENOIDS

Once you run BugRunner. The first three lines are import statements; they list the classes from GridWorld used in this program. UnboundedGrid; Now replace the line that creates the ActorWorld with this: So you can get the x-coordinate of a Bug like this: You can find the documentation for these classes at http: A constructor is a special method that creates new objects. The next two lines create a Bug and a Rock, and add them to world.

Make a copy of Manuql. You can read the documentation at http: The Student Manual uses vocabulary I have not presented yet, so to get you started, here is a quick preview:. Modify moveBug so that it takes an integer, nas a parameter, and moves the bug n times if it can.

Then you can access the predefined colors, like Color. Make a few bugs with different colors.

gridworld ap computer science case study student manual

Invoke clmputer methods canMovemove and turn and be sure you understand what they do. To create Bugs with different colors, we have to import Color: