All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface com.monpetitcoin.java.PrisonerGame.GameBoard

public abstract interface GameBoard
This interface is used to defined a common behavior for a game board. A game board must be able to:

Version:
1.00, 21 August 2001
Author:
François Suter
See Also:
com.monpetitcoin.java.PrisonerGame.Pawn

Variable Index

 o SHAPE_CIRCLE
This constant is used to indicate that the board expects its Pawns to draw themselves as circles
 o SHAPE_HEXAGON
This constant is used to indicate that the board expects its Pawns to draw themselves as hexagons
 o SHAPE_SQUARE
This constant is used to indicate that the board expects its Pawns to draw themselves as squares

Method Index

 o getItem(int)
 o getMaxNeighbors()
 o getTileShape()
 o hasNext()
Check if there is a further Pawn in the board.
 o hasPrevious()
Check if there is a previous Pawn in the board.
 o lastIndex()
This method positions the iterator on the last position of the board.
 o newItem(Pawn)
 o next()
Return the next Pawn in the board.
 o previous()
Return the previous Pawn in the board.
 o reset()
This method positions the iterator on the first position of the board.
 o setNeighborsLists()
This method computes the list of neighbors for a given Pawn and transmit it to the Pawn by invoking its setNeighbors() method.

Variables

 o SHAPE_SQUARE
 public static final int SHAPE_SQUARE
This constant is used to indicate that the board expects its Pawns to draw themselves as squares

 o SHAPE_HEXAGON
 public static final int SHAPE_HEXAGON
This constant is used to indicate that the board expects its Pawns to draw themselves as hexagons

 o SHAPE_CIRCLE
 public static final int SHAPE_CIRCLE
This constant is used to indicate that the board expects its Pawns to draw themselves as circles

Methods

 o newItem
 public abstract boolean newItem(com.monpetitcoin.java.PrisonerGame.Pawn newPawn)
Returns:
true if the Pawn is successfully added
false if the board is full and the Pawn couldn't be added
 o getTileShape
 public abstract int getTileShape()
Returns:
the value of the appropriate SHAPE_* constant
 o getMaxNeighbors
 public abstract int getMaxNeighbors()
Returns:
the maximum number of neighbors expected given the geometry of the board (e.g. 8 for a square grid, 6 for an hexagonal grid)
 o setNeighborsLists
 public abstract void setNeighborsLists()
This method computes the list of neighbors for a given Pawn and transmit it to the Pawn by invoking its setNeighbors() method.

See Also:
setNeighbors
 o next
 public abstract com.monpetitcoin.java.PrisonerGame.Pawn next()
Return the next Pawn in the board. This method is part of the board's built-in iterator.

Returns:
the next Pawn on the board, or null if the end of the board has been reached.
 o hasNext
 public abstract boolean hasNext()
Check if there is a further Pawn in the board. This method is part of the board's built-in iterator.

Returns:
true if there is at least one more Pawn to be reached with the iterator
false if the iterator has reached the end of the board.
 o previous
 public abstract com.monpetitcoin.java.PrisonerGame.Pawn previous()
Return the previous Pawn in the board. This method is part of the board's built-in iterator.

Returns:
the previous Pawn on the board, or null if the beginning of the board has been reached.
 o hasPrevious
 public abstract boolean hasPrevious()
Check if there is a previous Pawn in the board. This method is part of the board's built-in iterator.

Returns:
true if there is at least one more Pawn to be reached before the beginning of the board
false if the iterator has reached the beginning of the board.
 o reset
 public abstract void reset()
This method positions the iterator on the first position of the board. This method is part of the board's built-in iterator. No other method of the iterator should reset the board.

 o lastIndex
 public abstract void lastIndex()
This method positions the iterator on the last position of the board. This method is part of the board's built-in iterator.

 o getItem
 public abstract com.monpetitcoin.java.PrisonerGame.Pawn getItem(int itemID)
Parameters:
itemID - the unique ID number of a Pawn
Returns:
the Pawn identified by the ID number

All Packages  Class Hierarchy  This Package  Previous  Next  Index