API game (bug possible)
This commit is contained in:
69
2024-25/javaAPI/fr/iut_fbleau/GameAPI/IBoard.java
Normal file
69
2024-25/javaAPI/fr/iut_fbleau/GameAPI/IBoard.java
Normal file
@@ -0,0 +1,69 @@
|
||||
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 legal moves from this position
|
||||
*
|
||||
* @throws NullPointerException if the game is over
|
||||
* @return the iterator
|
||||
*/
|
||||
public boolean isLegal(AbstractPly c);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* constructor of Iterator over legal moves from this position
|
||||
*
|
||||
* @throws NullPointerException if the game is over
|
||||
* @return the iterator
|
||||
*/
|
||||
public Iterator<AbstractPly> iterator();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plays a given move on the plateau.
|
||||
* Should update history using
|
||||
* @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 in history
|
||||
*
|
||||
*/
|
||||
public void undoPly();
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user