click below
click below
Normal Size Small Size show me how
Gridworld APCS
Classes and methods from the 2008-2009 GridWorld case study for the APCS exam
Question | Answer |
---|---|
What is the value of Location.NORTH | 0 |
What is the value of Location.SOUTH | 180 |
What is the value of Location.EAST | 90 |
What is the value of Location.WEST | 270 |
What is the value of Location.NORTHEAST | 45 |
What is the value of Location.SOUTHEAST | 135 |
What is the value of Location.SOUTHWEST | 225 |
What is the value of Location.NORTHWEST | 315 |
What is the value of Location.LEFT | -90 |
What is the value of Location.RIGHT | 90 |
What is the value of Location.HALF_LEFT | -45 |
What is the value of Location.HALF_RIGHT | 45 |
What is the value of Location.FULL_CIRCLE | 360 |
What is the value of Location.HALF_CIRCLE | 180 |
What is the value of Location.AHEAD | 0 |
Which class does public Location (int r, int c)belong to? | Location |
Which class does public int GetRow() belong to? | Location |
Which class does public GetCol() belong to? | Location |
Which class does public Location getAdjacentLocation (int direction) belong to? | Location |
Which class does public int getDirectionToward (Location target) belong to? | Location |
Which class does public boolean equals (Object other) belong to? | Location |
Which class does public int compareTo (Object other)belong to? | Location |
Which class does public String toString()belong to? | Location |
Which class does public Actor() belong to? | Actor |
Which class does public Color getColor() belong to? | Actor |
Which class does public int getDirection() belong to? | Actor |
Which class does public Location getLocation() belong to? | Actor |
Which class does public Grid<Actor> getGrid() belong to? | Actor |
Which class does public void setColor (Color newColor) belong to? | Actor |
Which class does public void setDirection (int newDirection) belong to? | Actor |
Which class does public void moveTo(Location newLocation) belong to? | Actor |
Which class does public void putSelfInGrid (Grid<Actor> gr, Location loc) belong to? | Actor |
Which class does public void removeSelfFromGrid() belong to? | Actor |
Which class does public void act() belong to? | Actor or Bug |
Which class does public void String to String() belong to? | Actor |
Which class does public Bug() belong to? | Bug |
Which class does public Bug(Color bugColor) belong to? | Bug |
Which class does public void act() belong to? | Bug or Actor or BoxBug or Critter |
Which class does public void turn() belong to? | Bug |
Which class does public boolean canMove() belong to? | Bug |
Which class does public void move() belong to? | Bug |
Which class does public BoxBug (int length) belong to? | BoxBug |
Which class does public ArrayList<Actor> getActors() belong to? | Critter |
Which class does public void processActors (ArrayList<Actor> actors) belong to? | Critter |
Which class does public ArrayList<Location> getMoveLocations() belong to? | Critter |
Which class does public Location selectMoveLocation (ArrayList<location> locs) belong to? | Critter |
Which class does public void makeMove(Location loc) belong to? | Critter |
Which class does public void processActors (ArrayList<Actor> actors) belong to? | ChameleonCritter |
Which class does public void makeMove(location loc) belong to? | ChameleonCritter |
What does public Location getAdjacentLocation(int direction) do? | Returns adjacent location in compass direction closest to direction |
What does public int getDirectionTowards(Location target) do? | Returns direction, rounded to the nearest compass direction, from this location |
What does public int hasCode() do? | Generates and returns a has code for this location |
What does public boolean equals(Object other) do? | Used to compare Location objects |
What does public int compareTo(Object other) do? | Used to compare Location objects |
What does public String toString() do? | Returns a string representation of this Location in the form of (row, col) |
What does public Actor() do? | Default constructor - constructos a blue actor facing north |
What does public Color getColor() do? | Accessor method - returns color of this Actor |
What does public int getDirection() do? | Accessor method - returns direction of this Actor |
What does public Location getLocation() do? | Accessor method - returns location of this Actor |
What does public Grid<Actor> get Grid() do? | Accessor method - returns the grid of this Actor, or null if the Actor is not in the grid |
What does public void setColor(color newColor) do? | Mutator method - changes color of this Actor |
What does public void setDirection (int newDirection) do? | Mutator method - changes direction of this Actor |
What does public void moveTo (Location newLocation) do? | Moves this Actor to a new location |
What does public void putSelfInGrid (Grid<Actor> gr, Location loc) do? | Puts this Actor into a given grid |
What does public void removeSelfFromGrid() do? | Removes this Actor from the grid |
What does public act() do? | Reverses the direction of this actor |
What does the method public Bug () do? | Default constructor - creates a red bug |
What does the method public Bug (Color bugColor) do? | Constructor - creates a bug with a specified color |
What does the method public turn() do? | Turns the bug 45 degrees to the right |
What does the method boolean canMove() do? | Returns true if the bug can move, false if it cannot |
What does the method public void move() do? | Moves the big forward, placing a flower in it's previous location |
What does the method public BixBug() do? | Constructor - sets sideLength to the specified length and initializes steps to zero |
What does the method public ArrayList<Actor> getActors() do? | Returns a list of adjacent neighbooting actors |
What does the method public void processActors(ArrayList<Actor> actors) do? | Processes the actors - Critter eats all actors that are not rocks or other critters |
What does the method public ArrayList<location> getMoveLocations() do? | Returns a list of valid, adjacent, empty neighboring locations |
What does the method public Location selectMoveLocation(ArrayList<location> locs) do? | Selects the location for the next move |
What does the method public makeMove(Location loc) do? | Moves Critter to the specified location |
What does the method public void processActors(ArrayList<Actor> actors do? | Randomly selects ad adjacent neighbor, and changes the ChaeloenCritter to that actor's color |
What does the method public void makeMove(Location loc) do? | Moves like a Criter, but turns to face its new location |