public class JackBoard extends java.lang.Object implements IBoard, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected Piece |
black_piece |
protected java.util.List<Move> |
moves |
jadex.commons.SimplePropertyChangeSupport |
pcs |
protected Piece |
white_piece |
Constructor and Description |
---|
JackBoard() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
java.util.List<Piece> |
getCurrentPosition()
Get the current board position.
|
Move |
getLastMove()
Get all moves made so far.
|
java.util.List<Move> |
getMoves()
Get all moves made so far.
|
Piece |
getPiece(Position pos)
Get a piece for a location.
|
java.util.List<Move> |
getPossibleMoves()
Get possible moves.
|
int |
getSize()
Get the board size.
|
boolean |
isFreePosition(Position pos)
Test if a position is free.
|
boolean |
isSolution()
Test if it is a solution.
|
boolean |
move(Move move)
Do a move.
|
void |
removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
boolean |
takeback()
Takeback a move.
|
java.lang.String |
toString()
Get the string representation.
|
boolean |
wasLastMoveWhite()
Test if the last move was with a white piece.
|
protected Piece white_piece
protected Piece black_piece
protected java.util.List<Move> moves
public jadex.commons.SimplePropertyChangeSupport pcs
public java.util.List<Move> getPossibleMoves()
getPossibleMoves
in interface IBoard
public boolean move(Move move)
public boolean isSolution()
isSolution
in interface IBoard
public java.util.List<Move> getMoves()
public Move getLastMove()
getLastMove
in interface IBoard
public boolean wasLastMoveWhite()
wasLastMoveWhite
in interface IBoard
public java.util.List<Piece> getCurrentPosition()
getCurrentPosition
in interface IBoard
public boolean isFreePosition(Position pos)
isFreePosition
in interface IBoard
public void addPropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface IBoard
listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(jadex.commons.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface IBoard
listener
- The PropertyChangeListener to be removed.public java.lang.String toString()
toString
in class java.lang.Object