Files

80 lines
1.6 KiB
Java

package fr.iut_fbleau.GameAPI;
import java.util.Iterator;
/**
* The interface Board.
*/
public interface IBoard {
/**
* @return the current player
*/
public Player getCurrentPlayer();
/**
* Returns the game status
*
* @return true iff the game is over
*/
public boolean isGameOver();
/**
*
* @return the result (null if not over)
*/
public Result getResult();
/**
* checker of the legality of a ply from this position
*
* @return true iff the ply is legal
*/
public boolean isLegal(AbstractPly c);
/**
* constructor of Iterator over legal moves from this position
*
* @return the iterator
*/
public Iterator<AbstractPly> iterator();
/**
* Plays a given move on the plateau.
*
* @throws IllegalArgumentException if the move is always illegal (say from the wrong game)
* @throws IllegalStateException if the move is not legal in this position
*
* @param AbstractPly to be played
*
*/
public void doPly(AbstractPly c);
/**
* Resets the plateau to the position before the last move.
*
* @throws IllegalStateException if nothing to undo
*
*/
public void undoPly();
/**
* Creates a safe copy of the board.
*
* Intended to prevent cheating from a human via some interface,
* or from a bot playing via the API, or from a badly coded bot.
*
* Beware that the default implantation is unsafe and returns this.
*
* @return the copy
*/
public default IBoard safeCopy(){
return this;
}
}