|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
checkers.model.Board
public class Board
This class represents the board on which checkers is being played. The board holds a collection of pieces.
Field Summary |
---|
Fields inherited from interface checkers.CheckersConstants |
---|
ACCEPT, BLUE, CLIENTGAME, DRAW, HOST, HOSTGAME, JOIN, KING, LOCAL, LOCALGAME, NUM_SPACES, PLAYER1SET, PLAYER2SET, RESIGN, SINGLE, UPDATE, WHITE |
Constructor Summary | |
---|---|
Board()
This constructor creates a new board at the beginning of the game |
Method Summary | |
---|---|
int |
colorAt(int space)
This method returns the color of the piece at a certain space |
Piece |
getPieceAt(int space)
This method returns the piece at the certain position |
java.util.Vector |
getPieces(int color)
This method is a replacement for bluePieces and whitePieces. |
boolean |
hasPieceOf(int color)
This method returns if there is a piece of color on the board |
void |
kingPiece(int space)
This method creates a king piece |
boolean |
movePiece(Move theMove)
Move the piece at the start position to the end position |
boolean |
occupied(int space)
This method checks if the space on the board contains a piece |
void |
removePiece(int space)
This method removes piece at the position space |
int |
sizeOf()
This method returns the size of the board |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Board()
Method Detail |
---|
public boolean movePiece(Move theMove)
theMove
- -
current location of the piece
public boolean occupied(int space)
space
- -
the space that needs to be checked
public void removePiece(int space)
space
- -
the positon of the piece to be removedpublic void kingPiece(int space)
space
- -
the position at which the king piece is createdpublic int colorAt(int space)
space
- -
the position of the piece on the board
public Piece getPieceAt(int space)
space
- -
the space of the piece
public boolean hasPieceOf(int color)
color
- -
the color of the piece (as defined by constants in Piece)
public int sizeOf()
public java.util.Vector getPieces(int color)
color
- Color of pieces to get (as defined by constants in class Piece)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |