All Packages Class Hierarchy This Package Previous Next Index
Class kpalin.alabra.ChessSettings
java.lang.Object
|
+----kpalin.alabra.ChessSettings
- public class ChessSettings
- extends Object
- implements Serializable
This is container for initialization information.
- Author:
- Kimmo Palin
-
board
- Memory representation of the chessboard.
-
canFortify
- Wheather fortification is possible.
-
COLUMNS
- Number of columns on a chessboard
-
fontName
- Name of the font to be used in Control Panel.
-
fontSize
- Size of the font to be used in Control Panel.
-
moveLimit
- Number of moves that must be made in timeLimit.
-
ROWS
- Number of rows on a chessboard
-
startSide
- Side which takes first move
-
tileDim
- Dimensions of a tile.
-
timeLimit
- Time limit, in which must moveLimit moves be made.
-
ChessSettings()
- Creates new ChessSettings.
-
fortClone()
-
-
getFont()
- Returns the font to be used in Control Panel.
-
getMoveLimit()
-
-
getStartSide()
- Gives the starting side.
-
getTileDim()
- Gives the tile dimension.
-
getTimeLimit()
-
-
initStanding()
- Resets the board to normal initial standing.
-
pieceAt(int, int)
- Returns a Piece at specified position of the board.
-
setFontName(String)
- Set new name for Control Panel font.
-
setFontSize(int)
- Set new size for Control Panel font.
-
setFortify(int, int, boolean)
-
-
setMoveLimit(int)
- Sets move limit to moves, or 0 if moves<0.
-
setPieceTo(int, int, Piece)
- Sets a given Piece to a given location.
-
setQuickChess()
- Sets quickchess rules.
-
setStartSide(int)
- Sets the beginning side.
-
setTileDim(Dimension)
- Sets the dimensions of board tiles.
-
setTimeLimit(int)
- Sets new time limit to time or 0 if time<0.
ROWS
static final int ROWS
- Number of rows on a chessboard
COLUMNS
static final int COLUMNS
- Number of columns on a chessboard
tileDim
private static Dimension tileDim
- Dimensions of a tile.
canFortify
private boolean canFortify[][]
- Wheather fortification is possible.
- See Also:
- ChessPlay
board
private Piece board[][]
- Memory representation of the chessboard. Pieces are in their positions
and nulls are in empty spaces. A1 is at (0,0) and A2 at (1,0)
startSide
private int startSide
- Side which takes first move
fontName
private String fontName
- Name of the font to be used in Control Panel.
fontSize
private int fontSize
- Size of the font to be used in Control Panel.
timeLimit
private int timeLimit
- Time limit, in which must moveLimit moves be made.
moveLimit
private int moveLimit
- Number of moves that must be made in timeLimit. If moveLimit =0
all moves must be made in timeLimit.
ChessSettings
public ChessSettings()
- Creates new ChessSettings. That is initializes an empty board.
setTimeLimit
public void setTimeLimit(int time)
- Sets new time limit to time or 0 if time<0.
- Parameters:
- time - New time limit.
getTimeLimit
public int getTimeLimit()
- Returns:
- The time limit.
setMoveLimit
public void setMoveLimit(int moves)
- Sets move limit to moves, or 0 if moves<0.
- Parameters:
- moves - The new limit.
getMoveLimit
public int getMoveLimit()
- Returns:
- Move limit.
setQuickChess
public void setQuickChess()
- Sets quickchess rules. All moves in 5 minutes.
setFontName
public void setFontName(String name)
- Set new name for Control Panel font.
setFontSize
public void setFontSize(int size)
- Set new size for Control Panel font.
getFont
public Font getFont()
- Returns the font to be used in Control Panel. Doesn't (can't) check
for validity of the parameters.
setTileDim
static void setTileDim(Dimension d)
- Sets the dimensions of board tiles.
- Parameters:
- d - The tile dimension.
getTileDim
static Dimension getTileDim()
- Gives the tile dimension.
- Returns:
- The tile dimension.
setFortify
void setFortify(int side,
int type,
boolean value)
fortClone
boolean[][] fortClone()
pieceAt
Piece pieceAt(int row,
int col)
- Returns a Piece at specified position of the board.
- Parameters:
- row - Row of the piece
- col - Column of the piece
- Returns:
- Piece in position (row,col)
- Throws: ArrayIndexOutOfBoundsException
- Tried to reach inexistent location.
setPieceTo
void setPieceTo(int row,
int col,
Piece p) throws ArrayIndexOutOfBoundsException
- Sets a given Piece to a given location.
- Parameters:
- row - Row where to put the piece.
- col - Column where to put the piece.
- p - The piece to be put.;) Can also be null. (remove piece)
- Throws: ArrayIndexOutOfBoundsException
- User of the class can
do with this what ever they like.
setStartSide
void setStartSide(int side)
- Sets the beginning side.
- Parameters:
- side - The starting side (Piece.WHITE or Piece.BLACK)
getStartSide
int getStartSide()
- Gives the starting side.
- Returns:
- The starting side.
initStanding
void initStanding()
- Resets the board to normal initial standing.
All Packages Class Hierarchy This Package Previous Next Index