control loop in AbstractGame + minor update in API documentation + minor change of name in a getter

This commit is contained in:
2025-09-19 09:59:13 +02:00
parent bb2b77d208
commit f7f50f9ca8
3 changed files with 95 additions and 18 deletions

View File

@@ -6,9 +6,13 @@ import java.util.Deque;
/**
* An abstract class implementing the interface IBoard.
*
* used to implement some things to do with the update of the next player
* which is the same for all games and provides also a minimal
* implantation of the history mechanism.
* It is used to implement some things to do with the update of the next player
* which is the same for all turn taking games using a round robin and provides
* also a minimal implantation of the history mechanism.
*
* The current implantation works only for two players.
*
*
*/
public abstract class AbstractBoard implements IBoard{
@@ -40,7 +44,7 @@ public abstract class AbstractBoard implements IBoard{
/**
* @return the current player
*/
public Player getcurrentPlayer(){
public Player getCurrentPlayer(){
return this.currentPlayer;
}
@@ -57,20 +61,18 @@ public abstract class AbstractBoard implements IBoard{
*/
public abstract Result getResult();
/**
* checker of legal moves from this position
* checker of the legality of a ply from this position
*
* @throws NullPointerException if the game is over
* @return the iterator
* @return true iff the ply is legal
*/
public abstract boolean isLegal(AbstractPly c);
/**
* constructor of Iterator over legal moves from this position
*
* @throws NullPointerException if the game is over
* @return the iterator
*/
public abstract Iterator<AbstractPly> iterator();
@@ -79,7 +81,8 @@ public abstract class AbstractBoard implements IBoard{
/**
* Plays a given move on the plateau.
* Should update history using
* Should update history using removePlyFromHistory
*
* @throws IllegalArgumentException if the move is always illegal (say from the wrong game)
* @throws IllegalStateException if the move is not legal in this position
*
@@ -96,4 +99,10 @@ public abstract class AbstractBoard implements IBoard{
*/
public abstract void undoPly();
/**
* creates a safe copy of the board.
*
* @return the copy
*/
public abstract IBoard safeCopy();
}