pub struct BinaryExplorer<G: ActionOptimiser, A: NodeStoreTrait> { /* private fields */ }Implementations§
Source§impl<G: ActionOptimiser, A: NodeStoreTrait> BinaryExplorer<G, A>
impl<G: ActionOptimiser, A: NodeStoreTrait> BinaryExplorer<G, A>
pub fn new_checked( contract: Contract, initial_node: TrickNode, north_south_target: u8, ) -> Result<Self, BridgeCoreError>
pub fn current_side(&self) -> Side
Sourcepub fn explore_actions(&mut self) -> Result<bool, DoubleDummyError>
pub fn explore_actions(&mut self) -> Result<bool, DoubleDummyError>
use brydz_dd::{
node::{
TrickNode
},
};
use brydz_core::{
player::side::{SideMap, Side::*},
cards::trump::Trump,
bidding::Bid,
contract::{Contract, ContractParametersGen, ContractMechanics},
karty::{
suits::Suit::*,
cards::*,
set::CardSetStd,
card_set
}
};
use brydz_dd::actions::DistinctCardGrouper;
use brydz_dd::explore::{BinaryExplorer, ExploreOutput, Explorer};
use brydz_dd::hash::DummyNodeStore;
let contract = Contract::new(
ContractParametersGen::new(West, Bid::init(Trump::Colored(Diamonds), 1).unwrap()));
let hands = SideMap::new(
card_set![ACE_SPADES, QUEEN_SPADES, JACK_CLUBS, KING_CLUBS],
card_set!(ACE_HEARTS, KING_DIAMONDS, KING_HEARTS, JACK_DIAMONDS),
card_set![ACE_DIAMONDS, ACE_CLUBS, QUEEN_HEARTS, QUEEN_CLUBS],
card_set![KING_SPADES, QUEEN_DIAMONDS, JACK_SPADES, JACK_HEARTS ]);
let node = TrickNode::new_checked(hands, contract.current_side()).unwrap();
let mut explorer = BinaryExplorer::<DistinctCardGrouper, DummyNodeStore>::new_checked(contract.clone(), node.clone(), 1).unwrap();
assert_eq!(explorer.explore_actions(), Ok(true));
let mut explorer2 = BinaryExplorer::<DistinctCardGrouper, DummyNodeStore>::new_checked(contract.clone(), node.clone(), 2).unwrap();
assert_eq!(explorer2.explore_actions(), Ok(false));pub fn hint(&mut self) -> Result<TrackStep, DoubleDummyError>
pub fn update( &mut self, state_update: ExplorerStateUpdate, ) -> Result<(), BridgeCoreErrorGen<Card>>
pub fn state(&self) -> &ExplorerGameState<G>
Trait Implementations§
Source§impl<G: Clone + ActionOptimiser, A: Clone + NodeStoreTrait> Clone for BinaryExplorer<G, A>
impl<G: Clone + ActionOptimiser, A: Clone + NodeStoreTrait> Clone for BinaryExplorer<G, A>
Source§fn clone(&self) -> BinaryExplorer<G, A>
fn clone(&self) -> BinaryExplorer<G, A>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<G: Debug + ActionOptimiser, A: Debug + NodeStoreTrait> Debug for BinaryExplorer<G, A>
impl<G: Debug + ActionOptimiser, A: Debug + NodeStoreTrait> Debug for BinaryExplorer<G, A>
Auto Trait Implementations§
impl<G, A> Freeze for BinaryExplorer<G, A>
impl<G, A> RefUnwindSafe for BinaryExplorer<G, A>where
A: RefUnwindSafe,
G: RefUnwindSafe,
impl<G, A> Send for BinaryExplorer<G, A>
impl<G, A> Sync for BinaryExplorer<G, A>
impl<G, A> Unpin for BinaryExplorer<G, A>
impl<G, A> UnwindSafe for BinaryExplorer<G, A>where
A: UnwindSafe,
G: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.