SimpleAIPlayerGetAction Method

Uses the IDA* algorithm to find the best solution for the given puzzle. The strategy goes as follows:

During the Normal phase:

  • If the player has no puzzles, take a new puzzle.
  • If the player has more than one puzzle and more than one puzzle has a Place action at the end of its queue, use the Master action.
  • If the player already has a puzzle, he will take a new one if after solving the puzzles he already has, he will still have at least one tetromino left. If he will take a puzzle and which one it will be is determined by the following criteria:
    • how many pieces of which level he has in total
    • how many pieces of which level he has in his collection right now
    • if he is solving a black puzzle right now
    • how many puzzles are left in the black deck
  • There is a 3% random chance to use a recycle action.
  • Otherwise, pick the puzzle with the shortest solution and use its next action.
  • Near the end of the game, limit the number of puzzles based on the number of puzzles left in the black deck. Always try to have: number of unfinished puzzles <= number of puzzles left in the black deck.

During the EndOfTheGame phase:

  • If the player has no puzzles, attempt to use tetromino actions to gain more tetrominos, as leftover tetrominos may be used for tiebreakers.
  • If the player has unfinished puzzles, attempt to solve them, prioritizing the closest one to being solved first.

During the FinishingTouches phase:

  • If there are no unfinished puzzles, simply returns EndFinishingTouchesAction.
  • For each unfinished puzzle, the method attempts to solve it using only the tetrominos the player currently owns.
  • that provide a net positive score are included in the strategy.
  • The resulting list of actions is ordered to maximize the player's final score, ending with an EndFinishingTouchesAction.

Definition

Namespace: SimpleAIPlayer
Assembly: SimpleAIPlayer (in SimpleAIPlayer.dll) Version: 1.0.0+d0f5e2a7a5f4bb0431970f279d2f79d24b15d256
C#
protected override GameAction GetAction(
	GameStateGameInfo gameInfo,
	PlayerStatePlayerInfo myInfo,
	List<PlayerStatePlayerInfo> enemyInfos,
	TurnInfo turnInfo,
	ActionVerifier verifier
)

Parameters

gameInfo  GameStateGameInfo
Information about the shared resources.
myInfo  PlayerStatePlayerInfo
Information about the resources of THIS player
enemyInfos  ListPlayerStatePlayerInfo
Information about the resources of the OTHER players.
turnInfo  TurnInfo
Information about the current turn.
verifier  ActionVerifier
Verifier for verifying the validity of actions in the current game context.

Return Value

GameAction
The action the player wants to take.

Exceptions

InvalidOperationExceptionInvalid game phase

See Also