AIAbstractGameState

class AIAbstractGameState : NSObject, GKGameModel

An abstract class that represents a game state/model.

  • A structure that defines a state assessement.

    See more

    Declaration

    Swift

    public struct Assessement
  • The list of players in this model.

    Declaration

    Swift

    var players: [GKGameModelPlayer]? { get }
  • The currently active player in this model.

    Declaration

    Swift

    var activePlayer: GKGameModelPlayer? { get }
  • A string that describes the state to a receiver.

    Declaration

    Swift

    override var description: String { get }
  • The player in the game state.

    Declaration

    Swift

    var player: AIAbstractGamePlayer
  • The position of the exit door.

    Declaration

    Swift

    public var exit: CGPoint
  • Whether the player can leave the world successfully.

    Declaration

    Swift

    public var escapable: Bool
  • The list of all available inputs in the world.

    Declaration

    Swift

    public var inputs: [AIAbstractGameSignalSender]
  • The list of all available outputs in the world.

    Declaration

    Swift

    public var outputs: [AIAbstractGameSignalReceivable]
  • A list of objects that the player can pick up.

    Declaration

    Swift

    public var interactableObjects: [CGPoint]
  • Instantiate a game state.

    Declaration

    Swift

    init(with player: AIAbstractGamePlayer)

    Parameters

    player

    The player that is in the world.

  • Sets the game model’s internal state to that of the specified game model.

    Declaration

    Swift

    func setGameModel(_ gameModel: GKGameModel)

    Parameters

    gameModel

    The game model to set the internal model to.

  • Returns the set of moves available to the specified player.

    Declaration

    Swift

    func gameModelUpdates(for player: GKGameModelPlayer) -> [GKGameModelUpdate]?

    Parameters

    player

    An instance of your game’s player class representing the player whose moves are to be evaluated.

  • Updates the internal state of the game model to reflect the specified changes.

    Declaration

    Swift

    func apply(_ gameModelUpdate: GKGameModelUpdate)

    Parameters

    gameModelUpdate

    An instance of your custom class that implements the GKGameModelUpdate protocol, describing a move to be made in your game.

  • Create a copy of this object.

    Declaration

    Swift

    func copy(with zone: NSZone? = nil) -> Any
  • Returns whether the current state is a winning state.

    Declaration

    Swift

    func isWin(for player: GKGameModelPlayer) -> Bool
  • Returns an integer that scores the current state.

    Declaration

    Swift

    func score(for player: GKGameModelPlayer) -> Int