Class PlayRandomBehaviour
java.lang.Object
net.demilich.metastone.game.behaviour.AbstractBehaviour
net.demilich.metastone.game.behaviour.IntelligentBehaviour
net.demilich.metastone.game.behaviour.PlayRandomBehaviour
- All Implemented Interfaces:
Serializable,Cloneable,Behaviour
- Direct Known Subclasses:
PlayGameLogicRandomBehaviour
This behaviour chooses actions randomly.
It relies on its own internal Random instance as the state of its random choice generator and does not use
the GameLogic.getRandom() facilities at all.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets a name for the behaviour.protected RandomgetRandom(GameContext context) mulligan(GameContext context, Player player, List<Card> cards) Use the provided context, player and first hand cards to determine which cards to discard during a mulligan phase.<T> Set<T>randomSubset(List<T> items, int m, Random random) requestAction(GameContext context, Player player, List<GameAction> validActions) Requests an action from the player.Methods inherited from class net.demilich.metastone.game.behaviour.IntelligentBehaviour
isHumanMethods inherited from class net.demilich.metastone.game.behaviour.AbstractBehaviour
clone, mulliganAsync, onGameOver, requestActionAsync
-
Constructor Details
-
PlayRandomBehaviour
public PlayRandomBehaviour()
-
-
Method Details
-
getName
Description copied from interface:BehaviourGets a name for the behaviour. This should correspond to how the decisions are being made, e.g., a"Human Behaviour"or an"AI Behaviour.- Returns:
- A
Stringdescription of the behaviour.
-
mulligan
Description copied from interface:BehaviourUse the provided context, player and first hand cards to determine which cards to discard during a mulligan phase.- Specified by:
mulliganin interfaceBehaviour- Overrides:
mulliganin classIntelligentBehaviour- Parameters:
context- The game context.player- The player who's mulliganing.cards- The cards in the player's first hand.- Returns:
- The cards the player chose to discard.
-
getRandom
-
requestAction
Description copied from interface:BehaviourRequests an action from the player.- Parameters:
context- The game context where the choice is being made.player- The player who is making the choice.validActions- The valid actions the player has to choose from.- Returns:
- One of the
validActionsthat correspond to the player's choice.
-
randomSubset
-