1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! 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 Minmax Strategist is a generic AI that selects a game model update for a given player that maximises
/// potential gain, while minimising potential loss. It does this by examining all of the updates available
/// to the player in question, extrapolating the potential moves opposing players may take, projecting out
/// maxLookAheadDepth number of turns. The selected update will result in the greatest potential gain, balanced
/// against the potential gain of other players.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkminmaxstrategist?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GKMinmaxStrategist;
);
#[cfg(feature = "GKStrategist")]
extern_conformance!(
unsafe impl GKStrategist for GKMinmaxStrategist {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for GKMinmaxStrategist {}
);
impl GKMinmaxStrategist {
extern_methods!(
/// The maximum number of future turns that will be processed when searching for a move.
#[unsafe(method(maxLookAheadDepth))]
#[unsafe(method_family = none)]
pub unsafe fn maxLookAheadDepth(&self) -> NSInteger;
/// Setter for [`maxLookAheadDepth`][Self::maxLookAheadDepth].
#[unsafe(method(setMaxLookAheadDepth:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaxLookAheadDepth(&self, max_look_ahead_depth: NSInteger);
#[cfg(feature = "GKGameModel")]
/// Selects the best move for the specified player. If randomSource is not nil, it will randomly select
/// which move to use if there are one or more ties for the best. Returns nil if the player is invalid,
/// the player is not a part of the game model, or the player has no valid moves available.
#[unsafe(method(bestMoveForPlayer:))]
#[unsafe(method_family = none)]
pub unsafe fn bestMoveForPlayer(
&self,
player: &ProtocolObject<dyn GKGameModelPlayer>,
) -> Option<Retained<ProtocolObject<dyn GKGameModelUpdate>>>;
#[cfg(feature = "GKGameModel")]
/// Selects one move from the set of N best moves for the specified player, where N is equal to
/// numMovesToConsider. If randomSource is nil, it will not randomly select, but will behave like
/// bestMoveForPlayer and return the first best move. Returns nil if the player is invalid, the
/// player is not a part of the game model, or the player has no valid moves available.
#[unsafe(method(randomMoveForPlayer:fromNumberOfBestMoves:))]
#[unsafe(method_family = none)]
pub unsafe fn randomMoveForPlayer_fromNumberOfBestMoves(
&self,
player: &ProtocolObject<dyn GKGameModelPlayer>,
num_moves_to_consider: NSInteger,
) -> Option<Retained<ProtocolObject<dyn GKGameModelUpdate>>>;
);
}
/// Methods declared on superclass `NSObject`.
impl GKMinmaxStrategist {
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>;
);
}