Changes

Jump to: navigation, search

Computer Science/61b

7 bytes added, 02:46, 29 October 2006
Gameboard & chips ADT: -bb – updating, cleanup, formatting
Members: Paul, -bb; Andrew, -fe; Jordan, -er <!-- borokhov, vo, berk -->
===Gameboard & chips ADT===
/* Paul can do this - it's a essentially a copy from the Oceans project, so it's quick */ // Gameboard abstract data type– Gameboard class // board field stores a board using an array of Chips (not that important – '''fields''': public static final int SDEPTH = 10, given to no one has access to this field anyway)-depth constructor // '''methods are required to retrieve/store chips Gameboard class fields: private Chip[] board methods''':
// inserts a chip of the given color in the specified place as determined by an x, y coord pair
// returns true if the insertion succeeds; false otherwise
Chip retrieveChip(int x, int y)
// returns true if the given move is valid; false otherwise
/* Verified conditions:
# No chip may be placed in any of the four corners.
# No chip may be placed in a goal of the opposite color.
# No chip may be placed in a square that is already occupied.
# A player may not have more than two chips in a connected group, whether connected orthogonally or diagonally. */
boolean validMove(Move m)
// returns true if the chip cluster (if any) is small enough to permit a chip insertion at the given location as determined by an x, y coord pair; false otherwise
->could be inside or another method: boolean checkClusterSize(int x, int y)
// Chip abstract data type to hold information about chips– Chip class
// color field stores the chip's color as a static final int; x and y fields store the chip's x and y coords, respectively
Chip class // '''fields (all private)''': int color, int x, int y public static final int WHITE/BLACK = 1/0(this is how we refer to colors, though I don't think anyone would need to) // public final static int DIMENSION = 8 for the dimensions of the board // '''methods''':
// returns the chip's color
int getColor()
1,277
edits

Navigation menu