chess
Class ChessBoard
java.lang.Object
chess.ChessBoard
public class ChessBoard
- extends java.lang.Object
Constructor
Summary |
ChessBoard()
Creates a
new instance of ChessBoard Default version creates starting
setup |
Method Summary |
ChessPiece[] |
getRow(int rowNum)
return the
row corresponding to the passed index |
boolean |
movePiece(int startRow,
int startCol, int endRow, int endCol)
allow
unconstrained move of a piece from one location to another. |
java.lang.String |
toString()
Show board
- use compressed form so that it looks like a
board |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
wait, wait, wait |
board
protected ChessPiece[][] board
ChessBoard
public ChessBoard()
- Creates a new instance of ChessBoard Default version creates starting
setup
getRow
public ChessPiece[] getRow(int rowNum)
- return the row corresponding to the passed index
-
movePiece
public boolean movePiece(int startRow,
int startCol,
int endRow,
int endCol)
- allow unconstrained move of a piece from one location to another. Doesn't
check if the move is legal. Not for public consumption in general, but
probably ok for some in same package. Certainly could be used to implement
moves for different kinds of pieces - should probably have made protected
Should check indices for being in legal range, but don't do right now
-
toString
public java.lang.String toString()
- Show board - use compressed form so that it looks like a board
-
- Overrides:
toString
in class java.lang.Object
-