Difference between revisions of "Computer Science/61b"

From lensowiki
Jump to: navigation, search
(Methods: correction – these methods aren't in MachinePlayer...)
m (Lensovet moved page CS/61b to Computer Science/61b)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Project 2 modules==
+
*[[/Projects]]
Members: Paul, -bb; Andrew, -fe; Jordan, -er <!-- borokhov, vo, berk -->
+
*[[/Homework]]
===Gameboard & chips ADT===
 
/* Paul */
 
// Gameboard abstract data type – Gameboard class
 
// '''fields''': public static final int SDEPTH = 10, given to no-depth constructor
 
// '''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
 
boolean insertChip(int color, int x, int y)
 
// move a given chip to a specified place as determined by an x, y coord pair
 
// returns true if the move succeeds; false otherwise
 
boolean moveChip(Chip c, int x, int y)
 
// performs a move and returns true/false depending on whether it succeeded
 
boolean performMove(int color, Move m)
 
// returns the Chip at a given location as determined by an x, y coord pair
 
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)
 
 
// Chip abstract data type – 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
 
// '''fields''': 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()
 
// returns the x coord of the chip
 
int getX()
 
// returns the y coord of the chip
 
int getY()
 
  
===Changes to MachinePlayer class===
+
==External links==
====New fields====
+
*[http://www.cs.berkeley.edu/~jrs/61b/ Class website]
int color
 
int opponent
 
int depth
 
Gameboard board
 
 
 
====Methods====
 
As I mentioned to Jordan over e-mail, all of the methods and constructors in MachinePlayer class become pretty trivial after we write all of the methods in the Gameboard class. I (Paul) have already done all of them, so assuming everything else works as planned, we should be ok.
 

Latest revision as of 03:51, 20 February 2023