The GridWorld Case Study Methods

About this set

Created by:

yo_bootyhole  on October 17, 2010

Subjects:

ap computer science a

Description:

methods silly

Classes:

AP Computer Science

Log in to favorite or report as inappropriate.
Pop out
No Messages

You must log in to discuss this set.

The GridWorld Case Study Methods

public Location (int r, int c)
Constructs a location with given row and column
1/7
Preview our new flashcards mode!

Study:

Cards

Speller

Learn

Test

Scatter

Games:

Scatter

Space Race

Tools:

Export

Copy

Combine

Embed

Order by

Terms

Definitions

public Location (int r, int c) Constructs a location with given row and column
public int getRow(), public int getCol() Accessor methods that return the row or column of the Location
public Location getAdjacentLocation (int direction) Returns the adjacent location in the compass direction closest to direction.
public int getdirectionToward(Location target) Returns the direction, rounded to the nearest compass direction, from this location toward a target location.
public int hashCode() Generates and returns a hash code for this Location.
public boolean equals(Object other), public int compareTo(Object other) Compares Location objects. Two locations are equal if they have the same tow and column values. Ascending order for location is row-major, namely, start at (0,0) and proceed row by row from left to right.
public String toString() Returns a string representation of this Location in the form (row,col).

First Time Here?

Welcome to Quizlet, a fun, free place to study. Try these flashcards, find others to study, or make your own.

Set Champions

Scatter Champion

54.8 secs by Ligeia