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

Variable Index

 o board
Memory representation of the chessboard.
 o canFortify
Wheather fortification is possible.
 o COLUMNS
Number of columns on a chessboard
 o fontName
Name of the font to be used in Control Panel.
 o fontSize
Size of the font to be used in Control Panel.
 o moveLimit
Number of moves that must be made in timeLimit.
 o ROWS
Number of rows on a chessboard
 o startSide
Side which takes first move
 o tileDim
Dimensions of a tile.
 o timeLimit
Time limit, in which must moveLimit moves be made.

Constructor Index

 o ChessSettings()
Creates new ChessSettings.

Method Index

 o fortClone()
 o getFont()
Returns the font to be used in Control Panel.
 o getMoveLimit()
 o getStartSide()
Gives the starting side.
 o getTileDim()
Gives the tile dimension.
 o getTimeLimit()
 o initStanding()
Resets the board to normal initial standing.
 o pieceAt(int, int)
Returns a Piece at specified position of the board.
 o setFontName(String)
Set new name for Control Panel font.
 o setFontSize(int)
Set new size for Control Panel font.
 o setFortify(int, int, boolean)
 o setMoveLimit(int)
Sets move limit to moves, or 0 if moves<0.
 o setPieceTo(int, int, Piece)
Sets a given Piece to a given location.
 o setQuickChess()
Sets quickchess rules.
 o setStartSide(int)
Sets the beginning side.
 o setTileDim(Dimension)
Sets the dimensions of board tiles.
 o setTimeLimit(int)
Sets new time limit to time or 0 if time<0.

Variables

 o ROWS
 static final int ROWS
Number of rows on a chessboard

 o COLUMNS
 static final int COLUMNS
Number of columns on a chessboard

 o tileDim
 private static Dimension tileDim
Dimensions of a tile.

 o canFortify
 private boolean canFortify[][]
Wheather fortification is possible.

See Also:
ChessPlay
 o 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)

 o startSide
 private int startSide
Side which takes first move

 o fontName
 private String fontName
Name of the font to be used in Control Panel.

 o fontSize
 private int fontSize
Size of the font to be used in Control Panel.

 o timeLimit
 private int timeLimit
Time limit, in which must moveLimit moves be made.

 o moveLimit
 private int moveLimit
Number of moves that must be made in timeLimit. If moveLimit =0 all moves must be made in timeLimit.

Constructors

 o ChessSettings
 public ChessSettings()
Creates new ChessSettings. That is initializes an empty board.

Methods

 o setTimeLimit
 public void setTimeLimit(int time)
Sets new time limit to time or 0 if time<0.

Parameters:
time - New time limit.
 o getTimeLimit
 public int getTimeLimit()
Returns:
The time limit.
 o setMoveLimit
 public void setMoveLimit(int moves)
Sets move limit to moves, or 0 if moves<0.

Parameters:
moves - The new limit.
 o getMoveLimit
 public int getMoveLimit()
Returns:
Move limit.
 o setQuickChess
 public void setQuickChess()
Sets quickchess rules. All moves in 5 minutes.

 o setFontName
 public void setFontName(String name)
Set new name for Control Panel font.

 o setFontSize
 public void setFontSize(int size)
Set new size for Control Panel font.

 o getFont
 public Font getFont()
Returns the font to be used in Control Panel. Doesn't (can't) check for validity of the parameters.

 o setTileDim
 static void setTileDim(Dimension d)
Sets the dimensions of board tiles.

Parameters:
d - The tile dimension.
 o getTileDim
 static Dimension getTileDim()
Gives the tile dimension.

Returns:
The tile dimension.
 o setFortify
 void setFortify(int side,
                 int type,
                 boolean value)
 o fortClone
 boolean[][] fortClone()
 o 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.
 o 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.
 o setStartSide
 void setStartSide(int side)
Sets the beginning side.

Parameters:
side - The starting side (Piece.WHITE or Piece.BLACK)
 o getStartSide
 int getStartSide()
Gives the starting side.

Returns:
The starting side.
 o initStanding
 void initStanding()
Resets the board to normal initial standing.


All Packages  Class Hierarchy  This Package  Previous  Next  Index