Class AbstractGameBoard

java.lang.Object
  extended by AbstractGameBoard
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CheckersGameBoard, ChessGameBoard, OthelloGameBoard

public abstract class AbstractGameBoard
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

AbstractGameBoard class This class is to provide some structure to the GameBoard interface for two player turn based games with 6 pieces or less

Author:
Brian Horan
See Also:
Serialized Form

Field Summary
 int[][] cells
           
static int ILLEGAL
          used to represent an illegal cell on the board that can have no other value in it
static int NOTHING
          used to represent nothing being in a cell on the game board
static int PLAYER1_1
          used to represent player 1's first piece
static int PLAYER1_2
          used to represent player 1's second piece
static int PLAYER1_3
          used to represent player 1's third piece
static int PLAYER1_4
          used to represent player 1's fourth piece
static int PLAYER1_5
          used to represent player 1's fifth piece
static int PLAYER1_6
          used to represent player 1's sixth piece
static int PLAYER2_1
          used to represent player 2's first piece
static int PLAYER2_2
          used to represent player 2's second piece
static int PLAYER2_3
          used to represent player 2's third piece
static int PLAYER2_4
          used to represent player 2's fourth piece
static int PLAYER2_5
          used to represent player 2's fifth piece
static int PLAYER2_6
          used to represent player 2's sixth piece
 int turn
           
 
Constructor Summary
AbstractGameBoard()
           
 
Method Summary
 void changeTurn()
          changeTurn used to change the current value of turn
abstract  java.lang.String checkStatus(boolean findCheckMate)
          chackStatus used to check the status of a game (winner, loser, draw, etc.)
 void chooseCell(int row, int col, int value)
          chooseCell used to put a value into a cell
abstract  AbstractGameBoard clone()
          clone used to "clone" the gameboard and return the same board
abstract  int getCaptured()
          getCaptured used to find out the piece that was captured
 int getCell(int row, int col)
          getCell used to return the value in a cell
 int getTurn()
          getTurn used to return the value of turn
abstract  java.lang.Boolean isLegalMove(java.lang.Object testMove, java.lang.Boolean commitMove)
          isLegalMove used to see if a Dimension(should be parsed into two ints to get the row and col of the game board)is a legal "move" and if commitMove is set to true it will actually commit the move
abstract  java.lang.Boolean noMove()
          noMove() used to see if a player has no where to move
abstract  void resetBoard()
          resetBoard used to reset the board back to its default setting
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cells

public int[][] cells

turn

public int turn

NOTHING

public static final int NOTHING
used to represent nothing being in a cell on the game board

See Also:
Constant Field Values

PLAYER1_1

public static final int PLAYER1_1
used to represent player 1's first piece

See Also:
Constant Field Values

PLAYER1_2

public static final int PLAYER1_2
used to represent player 1's second piece

See Also:
Constant Field Values

PLAYER1_3

public static final int PLAYER1_3
used to represent player 1's third piece

See Also:
Constant Field Values

PLAYER1_4

public static final int PLAYER1_4
used to represent player 1's fourth piece

See Also:
Constant Field Values

PLAYER1_5

public static final int PLAYER1_5
used to represent player 1's fifth piece

See Also:
Constant Field Values

PLAYER1_6

public static final int PLAYER1_6
used to represent player 1's sixth piece

See Also:
Constant Field Values

PLAYER2_1

public static final int PLAYER2_1
used to represent player 2's first piece

See Also:
Constant Field Values

PLAYER2_2

public static final int PLAYER2_2
used to represent player 2's second piece

See Also:
Constant Field Values

PLAYER2_3

public static final int PLAYER2_3
used to represent player 2's third piece

See Also:
Constant Field Values

PLAYER2_4

public static final int PLAYER2_4
used to represent player 2's fourth piece

See Also:
Constant Field Values

PLAYER2_5

public static final int PLAYER2_5
used to represent player 2's fifth piece

See Also:
Constant Field Values

PLAYER2_6

public static final int PLAYER2_6
used to represent player 2's sixth piece

See Also:
Constant Field Values

ILLEGAL

public static final int ILLEGAL
used to represent an illegal cell on the board that can have no other value in it

See Also:
Constant Field Values
Constructor Detail

AbstractGameBoard

public AbstractGameBoard()
Method Detail

chooseCell

public void chooseCell(int row,
                       int col,
                       int value)
chooseCell used to put a value into a cell

Parameters:
row - the row of the cell that is being choosen
col - the column of the cell that is being choosen
value - the value that will be placed in the cell

changeTurn

public void changeTurn()
changeTurn used to change the current value of turn


getTurn

public int getTurn()
getTurn used to return the value of turn

Returns:
the value of turn (1 or 2)

getCell

public int getCell(int row,
                   int col)
getCell used to return the value in a cell

Parameters:
row - the row of the cell that the user wishes to get
col - the column of the cell that the user wishes to get
Returns:
the value in the cell that the user wishes to get

isLegalMove

public abstract java.lang.Boolean isLegalMove(java.lang.Object testMove,
                                              java.lang.Boolean commitMove)
isLegalMove used to see if a Dimension(should be parsed into two ints to get the row and col of the game board)is a legal "move" and if commitMove is set to true it will actually commit the move

Parameters:
testMove - the dimension(row, col) of the cell
commitMove - whether or not the move should be commited
Returns:
if the move is legal

resetBoard

public abstract void resetBoard()
resetBoard used to reset the board back to its default setting


checkStatus

public abstract java.lang.String checkStatus(boolean findCheckMate)
chackStatus used to check the status of a game (winner, loser, draw, etc.)

Returns:
explains the status of the game

noMove

public abstract java.lang.Boolean noMove()
noMove() used to see if a player has no where to move

Returns:
whether or not the current player has a turn

clone

public abstract AbstractGameBoard clone()
clone used to "clone" the gameboard and return the same board

Overrides:
clone in class java.lang.Object
Returns:
a copy of the current game board

getCaptured

public abstract int getCaptured()
getCaptured used to find out the piece that was captured

Returns:
the integer value of the piece that was captured