Creates an instance of DefaultAI.
The number of the player the A.I will control
The interface by which the A.I will take actions and observe state
The DeckList of the deck the A.I will play
The DeckList of the deck the A.I will use
A ClientGame instance for the A.I to observe and take actions
The number of the player which the A.I will control
Adds an action to be run at some point in the future depending on the A.Is timing mode
The action to be added to the sequence
If true the action will be added to the beginning of the sequence, otherwise it will go at the end.
Checks if we can take an action, if we can then takes the next one in the action sequence.
Chooses which, if any, units to attack with. The A.I will choose to attack with any units it would not block if it were the opponent. That is to say, any unit where the canFavorablyBlock function returns false for all enemy units.
Known Flaws
Determines what units should block enemy attackers.
If the enemy attack is potentially lethal, the A.I will focus on minimizing damage in the least disadvantageous way but it will be willing to sacrifice units to block without trading (chump blocks).
Otherwise the A.I will only make blocks considered to be favorable by the canFavorablyBlock function.
Known Flaws
Analyzes whether a blocker can favorably block an attacker. A block is considered favorable under any of the following circumstances
Notably, this function cannot handle blocking with multiple units (even though that is legal).
A simple heuristic to determine which card is best to draw This heuristic assumes it is best to draw cards whose cost is close to the amount of resources we have.
Categorizes a block by what its outcome will be (if the attacker, blocker or both will die)
Evaluates a card based on its value and the value of its target.
The card to be evaluated
Creates an evaluated action from an enchantment.
Currently the score is based on the ratio between the enchantments cost and its power.
The enchantment to evaluate
Gets the best target for a card with a targeter. The best target is considered to be the one with the highest evaluateTarget value.
Returns the cards that should be chosen for a given choice based on its heuristic
Returns a deckbuilder to be used for limited tournaments
Get the appropriate heuristic for making a choice
Returns the enchantments we have enough energy to empower or diminish
Computes the most common resource among a set of cards (such as a deck or hand)
Gets the number of the player this A.I controlls
Decides what resource to play next based on the following heuristic.
If the A.I has unplayable cards it in its hand, it looks at its hand and decides which card it is closest to being able to play but is not yet able to. It chooses a resource which gets it closer to playing that card.
Otherwise it applies the same logic, but to its deck list.
Finally, if it can play every card in its hand and deck, it simply plays the most common resource in its deck (based on average card cost).
A Game Synchronization Event sent by the server
Makes a choice when requested to by the game engine (such as what cards to mulligan)
Signals to the A.I that it has gained priority and may take actions
Plays a card based on an action
Runs an action (either playing a card or modifying an enchantment)
Selects a series of actions to take. Currently there are two actions, playing a card or modifying an enchantment.
All actions have a energy cost thus to determine which ones to use we compute their heuristic values. Then we use a knapsack algorithm to get the highest total value of actions with our available energy.
Adds a list of actions to be run to end of the sequence.
The actions to add
Tells the A.I to start taking actions, but to spread them out over time. It will also wait until the given animator has completed any animations. This is to keep the A.I from taking all its actions simultaneously when playing against a human.
Tells the A.I to start acting and to immediatly take any action it likes. This is to make the A.I faster for A.I vs A.I battles
Tells the A.I to stop taking any moves when the game is over
Triggers the A.I to consider what its next action should be
Generated using TypeDoc
A heuristics based A.I
This is the default opponent for singleplayer.
It is built on heuristics and does not use any tree search based algorithm. As such, it runs quite fast but is prone to making short sighted moves.
Known Flaws