AIGameStrategist

class AIGameStrategist

An class that represents an agent in the game.

  • The internal game strategist that will be used to determine actions.

    Declaration

    Swift

    var strategy: GKStrategist
  • The state that the agent is assessing for best actions.

    Declaration

    Swift

    var state: AIAbstractGameState { get set }
  • A string that describes the strategist to a receiver.

    Declaration

    Swift

    var description: String { get }
  • Initialize a strategist.

    Declaration

    Swift

    init(with initialState: AIAbstractGameState)

    Parameters

    initialState

    The initial state of the game world.

  • Initialize a strategist.

    Declaration

    Swift

    init(with initialState: AIAbstractGameState, budget: Int)

    Parameters

    initialState

    The initial state of the game world.

    budget

    The maximum number of times the strategist can look forward to.

  • Initialize a strategist.

    Declaration

    Swift

    init(with strategy: GKStrategist, reading state: AIAbstractGameState)

    Parameters

    strategy

    The GKStrategist that will be used to determine best actions.

    state

    The initial state of the game world.

  • Update the strategist’s state to a new state for analysis.

    Declaration

    Swift

    func update(with state: AIAbstractGameState)

    Parameters

    state

    The new state to update to.

  • Returns the nest best action for the player.

    Declaration

    Swift

    func nextAction() -> AIGameDecision