Interface Strategy
- All Known Implementing Classes:
HMIStrategy,RandomStrategy,SkipStrategy,StrategyAdapter
public interface Strategy
This interface represents a generic strategy behavior (i.e. choose an action to play by a
Player).
This interface allows to listens game events, see GameListener, MisdesignListener, RoundListener, and TurnListener- Author:
- Belegkarnil
-
Method Summary
Modifier and TypeMethodDescriptionThe method represents the choice made by the strategy based on the current player the use the strategy, the current board status and his opponentvoidThis method is called before a game starts in order to allow the strategy to listen events.voidunregister(Game game) This method is called after a game finishes in order to clear and the strategy stops to listen events.
-
Method Details
-
plays
The method represents the choice made by the strategy based on the current player the use the strategy, the current board status and his opponent- Parameters:
myself- The current player that plays the strategyboard- The current board statusopponent- The opponent player- Returns:
- The action to play by myself #
Player
-
register
This method is called before a game starts in order to allow the strategy to listen events. (seeGame.addGameListener(GameListener),Game.addMisdesignListener(MisdesignListener),Game.addRoundListener(RoundListener), andGame.addTurnListener(TurnListener))- Parameters:
game- the new game to listen events
-
unregister
This method is called after a game finishes in order to clear and the strategy stops to listen events. (seeGame.removeGameListener(GameListener),Game.removeMisdesignListener(MisdesignListener),Game.removeRoundListener(RoundListener), andGame.removeTurnListener(TurnListener))- Parameters:
game- the finished game to stop listening events
-