AIPlayerBaseGetRewardAsync Method

Asynchronously passes the parameters to GetReward(ListTetrominoShape, Puzzle) and returns a Task containing the result. Note that the player doesn't get the current game context here. This is because this function will be called right after he completes a puzzle and therefore he knows the current game state from the last GetActionAsync(GameStateGameInfo, PlayerStatePlayerInfo, TurnInfo, ActionVerifier, CancellationToken) call.

Definition

Namespace: ProjectLCore.Players
Assembly: ProjectLCore (in ProjectLCore.dll) Version: 1.0.0+d0f5e2a7a5f4bb0431970f279d2f79d24b15d256
C#
public override sealed Task<TetrominoShape> GetRewardAsync(
	List<TetrominoShape> rewardOptions,
	Puzzle puzzle,
	CancellationToken cancellationToken = default
)

Parameters

rewardOptions  ListTetrominoShape
A nonempty list containing rewards to choose from.
puzzle  Puzzle
The puzzle that was completed.
cancellationToken  CancellationToken  (Optional)
A cancellation token to observe while waiting for the task to complete.

Return Value

TaskTetrominoShape
A task representing the tetromino the player wants to take.

Remarks

If there is only one reward option, it will be chosen automatically and GetReward(ListTetrominoShape, Puzzle) will not be called.

Exceptions

OperationCanceledExceptionThe task was canceled.

See Also