objc2-gameplay-kit 0.3.2

Bindings to the GameplayKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// The Monte Carlo Strategist is a generic AI that selects a game model update for a given player that results
    /// in the highest likelihood for that player to eventually win the game. It does this by sampling the updates available
    /// to the player in question. In doing this it will select the update it knows to produce the best result so far, expanding on this
    /// selection, simulating the rest of the game from that expansion, and then propogating the results (win or loss) upwards.
    /// It will do this until the budget has been reached, then returning the choice it has deemed best suited for the player in question.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkmontecarlostrategist?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GKMonteCarloStrategist;
);

#[cfg(feature = "GKStrategist")]
extern_conformance!(
    unsafe impl GKStrategist for GKMonteCarloStrategist {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GKMonteCarloStrategist {}
);

impl GKMonteCarloStrategist {
    extern_methods!(
        /// The maximum number of samples that will be processed when searching for a move.
        #[unsafe(method(budget))]
        #[unsafe(method_family = none)]
        pub unsafe fn budget(&self) -> NSUInteger;

        /// Setter for [`budget`][Self::budget].
        #[unsafe(method(setBudget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBudget(&self, budget: NSUInteger);

        /// A weight that encourages exploration of less visited updates versus the continued exploitation of previously visited updates.
        #[unsafe(method(explorationParameter))]
        #[unsafe(method_family = none)]
        pub unsafe fn explorationParameter(&self) -> NSUInteger;

        /// Setter for [`explorationParameter`][Self::explorationParameter].
        #[unsafe(method(setExplorationParameter:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExplorationParameter(&self, exploration_parameter: NSUInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl GKMonteCarloStrategist {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}