pub struct GameEngine {
pub rules: Ruleset,
pub state: GameState,
pub cards: CardRegistry,
pub scripting: RhaiEngine,
/* private fields */
}Fields§
§rules: Ruleset§state: GameState§cards: CardRegistry§scripting: RhaiEngineImplementations§
Source§impl GameEngine
impl GameEngine
pub fn new(rules: Ruleset, seed: u64, initial_state: GameState) -> Self
Sourcepub fn from_ruleset(rules: Ruleset, seed: u64) -> Self
pub fn from_ruleset(rules: Ruleset, seed: u64) -> Self
Build a GameEngine directly from a Ruleset. This will create a minimal GameState
via GameState::from_ruleset.
pub fn legal_actions(&self, _player: PlayerId) -> Vec<Action>
Sourcepub fn next_stack_id(&mut self) -> u32
pub fn next_stack_id(&mut self) -> u32
Generate the next unique stack item ID
Sourcepub fn next_choice_id(&mut self) -> u32
pub fn next_choice_id(&mut self) -> u32
Generate the next unique choice ID
pub fn apply_action( &mut self, player: PlayerId, action: Action, ) -> Result<StepResult, EngineError>
Auto Trait Implementations§
impl !Freeze for GameEngine
impl !RefUnwindSafe for GameEngine
impl Send for GameEngine
impl Sync for GameEngine
impl Unpin for GameEngine
impl !UnwindSafe for GameEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more