SimpleAIPlayer Class
A Simple AI player that chooses the best puzzle to solve and then solves it using IDA*.
Namespace: SimpleAIPlayerAssembly: SimpleAIPlayer (in SimpleAIPlayer.dll) Version: 1.0.0+d0f5e2a7a5f4bb0431970f279d2f79d24b15d256
public class SimpleAIPlayer : AIPlayerBase
- Inheritance
- Object Player AIPlayerBase SimpleAIPlayer
GetAction |
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.
(Overrides AIPlayerBaseGetAction(GameStateGameInfo, PlayerStatePlayerInfo, ListPlayerStatePlayerInfo, TurnInfo, ActionVerifier)) |
GetReward |
Chooses a random reward.
(Overrides AIPlayerBaseGetReward(ListTetrominoShape, Puzzle)) |
Init |
Does nothing.
(Overrides AIPlayerBaseInit(Int32, ListPuzzle, String)) |