Skip to content

Package: MinMaxGame

MinMaxGame

Coverage

1: package de.fhdw.gaming.ipspiel22.searchtree.domain;
2: import java.util.List;
3: import de.fhdw.gaming.core.domain.GameException;
4: import de.fhdw.gaming.core.domain.Move;
5: import de.fhdw.gaming.core.domain.Player;
6: import de.fhdw.gaming.core.domain.State;
7: /**
8: * Game interface for the MinMax algorithm.
9: *
10: * @param <P> The type of player.
11: * @param <S> The type of state.
12: * @param <M> The type of move.
13: */
14: public interface MinMaxGame<P extends Player<P>, S extends State<P, S>, M extends Move<P, S>> {
15:
16: /**
17: * Function which evaluate the current state of the game into a double for calculations.
18: *
19: * @return a double value for the current game state.
20: */
21: double evaluateStateful();
22: /**
23: * Function to check if the game is over in this current state.
24: *
25: * @return Boolean (gameOver - true / gameIsPlaying - false).
26: */
27: boolean isGameOver();
28: /**
29: * Function to get all possible moves for a player.
30: */
31: List<M> getPossibleMoves();
32: /**
33: * After the First Possible Moves where commited.
34: * @param move the move that will be saved.
35: * @return
36: */
37: M saveFirstMoves(M move);
38:
39: /**
40: * Execute a move in the game.
41: *
42: * @param move the move which should be execute.
43: */
44: void commitMove(M move) throws GameException;
45: /**
46: * Undo a move in the game.
47: *
48: * @param move the move which should be undo.
49: */
50: void rollbackMove(M move);
51: }