AIGameStrategy
class AIGameStrategy : NSObject, GKStrategist
A base strategy class.
-
The console that the strategy will send messages to.
Declaration
Swift
var console: ConsoleViewModel?
-
The game model that will be used in the particular strategy.
Declaration
Swift
var gameModel: GKGameModel?
-
The random source that the strategy can use.
Declaration
Swift
var randomSource: GKRandom?
-
A list of positions for all of the active inputs the agent encounters.
Declaration
Swift
var activated: [CGPoint] { get set }
-
The closest input to the player.
Declaration
Swift
var closestInput: AIAbstractGameSignalSender?
-
The closest object to the player.
Declaration
Swift
var closestObject: CGPoint?
-
Returns the best move for the active player.
Declaration
Swift
func bestMoveForActivePlayer() -> GKGameModelUpdate?
-
Returns the closest input device relative to the player.
The closest input is determined by finding the minimum distance of all possible inputs that have not been added to the activated list.
Declaration
Swift
public func closestInput(in state: AIAbstractGameState) -> AIAbstractGameSignalSender?
Parameters
state
The state the agent will assess to determine which input to target.
Return Value
The input device closest to the player, or nil.
-
Returns the closest object relative to the player.
Declaration
Swift
func closestObject(in state: AIAbstractGameState) -> CGPoint?
Parameters
state
The state the agent will assess to determine which object to target.
Return Value
The input device closest to the player, or nil.
-
Returns the action responsible for providing the closest path to the specified input.
Declaration
Swift
func closestPath(to input: AIAbstractGameSignalSender?, in state: AIAbstractGameState) -> String
Parameters
input
The input for the agent to target.
state
The state the agent will assess to determine the move.
-
Returns the action responsible for providing the closest path to the specified object.
Declaration
Swift
func closestPath(to object: CGPoint?, in state: AIAbstractGameState) -> String
Parameters
object
The object for the agent to target.
state
The state the agent will assess to determine the move.
-
Returns the action responsible for providing the closest path to the exit.
Declaration
Swift
func closestPath(in state: AIAbstractGameState) -> String
Parameters
state
The state the agent will assess to determine the move.