Package jadex.bdi.puzzle
Class JackBoard
java.lang.Object
jadex.bdi.puzzle.JackBoard
- All Implemented Interfaces:
IBoard
,Serializable
The View Board represents the puzzle board and the pegs.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a PropertyChangeListener to the listener list.Get the current board position.Get all moves made so far.getMoves()
Get all moves made so far.Get a piece for a location.Get possible moves.int
getSize()
Get the board size.boolean
isFreePosition
(Position pos) Test if a position is free.boolean
Test if it is a solution.boolean
Do a move.void
Remove a PropertyChangeListener from the listener list.boolean
takeback()
Takeback a move.boolean
Test if the last move was with a white piece.
-
Field Details
-
white_piece
-
black_piece
-
moves
-
pcs
-
-
Constructor Details
-
JackBoard
public JackBoard()
-
-
Method Details
-
getPiece
Get a piece for a location. -
getPossibleMoves
Get possible moves.- Specified by:
getPossibleMoves
in interfaceIBoard
- Returns:
- Get all possible move.
-
move
Do a move. -
takeback
public boolean takeback()Takeback a move. -
isSolution
public boolean isSolution()Test if it is a solution.- Specified by:
isSolution
in interfaceIBoard
- Returns:
- True, if solution.
-
getMoves
Get all moves made so far. -
getLastMove
Get all moves made so far.- Specified by:
getLastMove
in interfaceIBoard
-
wasLastMoveWhite
public boolean wasLastMoveWhite()Test if the last move was with a white piece. When no move was made, it return true.- Specified by:
wasLastMoveWhite
in interfaceIBoard
- Returns:
- True, is last move was with white piece.
-
getSize
public int getSize()Get the board size. -
getCurrentPosition
Get the current board position.- Specified by:
getCurrentPosition
in interfaceIBoard
-
isFreePosition
Test if a position is free.- Specified by:
isFreePosition
in interfaceIBoard
-
addPropertyChangeListener
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Specified by:
addPropertyChangeListener
in interfaceIBoard
- Parameters:
listener
- The PropertyChangeListener to be added.
-
removePropertyChangeListener
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.- Specified by:
removePropertyChangeListener
in interfaceIBoard
- Parameters:
listener
- The PropertyChangeListener to be removed.
-