GameLogic
 All Data Structures Files Functions Variables Friends
Public Member Functions | Protected Attributes
gameController::Action Class Referenceabstract
Inheritance diagram for gameController::Action:
gameController::Move gameController::Shot gameController::WrestQuaffle

Public Member Functions

 Action ()=default
 
 Action (std::shared_ptr< gameModel::Environment > env, std::shared_ptr< gameModel::Player > actor, gameModel::Position target)
 
virtual ~Action ()=default
 
virtual auto execute () const -> std::pair< std::vector< ActionResult >, std::vector< gameModel::Foul >>=0
 
virtual auto successProb () const -> double=0
 
virtual auto check () const -> ActionCheckResult=0
 
virtual auto executeAll () const -> std::vector< std::pair< std::shared_ptr< gameModel::Environment >, double >>=0
 
const gameModel::PositiongetTarget () const
 

Protected Attributes

std::shared_ptr
< gameModel::Player
actor
 
std::shared_ptr
< gameModel::Environment
env
 
gameModel::Position target {}
 

Constructor & Destructor Documentation

gameController::Action::Action ( )
default

default constructor for the Action class.

gameController::Action::Action ( std::shared_ptr< gameModel::Environment env,
std::shared_ptr< gameModel::Player actor,
gameModel::Position  target 
)

main constructor for the Action class.

Parameters
envThe environment to operate on
actorthe actor
targetthe target position
virtual gameController::Action::~Action ( )
virtualdefault

default destructors for the Action class.

Member Function Documentation

virtual auto gameController::Action::check ( ) const -> ActionCheckResult
pure virtual

Checks if the Action is possible an if it may result in a foul

Returns
See ActionCheckResult

Implemented in gameController::Move, gameController::WrestQuaffle, and gameController::Shot.

virtual auto gameController::Action::execute ( ) const -> std::pair< std::vector< ActionResult >, std::vector< gameModel::Foul >>
pure virtual

executes the Action. Method is not deterministic.

Exceptions
std::runtime_exceptionif Action is impossible
Returns
List of ramifications from the action execution, list of fouls during the execution

Implemented in gameController::Move, gameController::WrestQuaffle, and gameController::Shot.

virtual auto gameController::Action::executeAll ( ) const -> std::vector< std::pair< std::shared_ptr< gameModel::Environment >, double >>
pure virtual

Produces a list with all possible outcomes of the Action and the respective transition probabilities.

Returns
List of pairs consisting of the resulting Environment and the probability of landing in that state

Implemented in gameController::Move, gameController::WrestQuaffle, and gameController::Shot.

const gameModel::Position & gameController::Action::getTarget ( ) const

Getter

Returns
target position of the Action
virtual auto gameController::Action::successProb ( ) const -> double
pure virtual

Calculates the probability of a successful execution

Implemented in gameController::Move, gameController::WrestQuaffle, and gameController::Shot.


The documentation for this class was generated from the following files: