Coup

Struct Coup 

Source
pub struct Coup { /* private fields */ }
Expand description

The Coup game engine.

Implementations§

Source§

impl Coup

Source

pub fn new(user_bots: Vec<Box<dyn BotInterface>>) -> Self

Start a new Coup game by passing in all your bots in a Vec.

Source

pub fn new_deck() -> Vec<Card>

A public method to get a new deck. This can be used by bots to make sure you get the same amount of cards as the engine does.

Source

pub fn play(&mut self)

Playing a game which means we setup the table, give each bots their cards and coins and start the game loop.

Source

pub fn looping(&mut self, rounds: u64)

Play n number of rounds and tally up the score in the CLI.

Trait Implementations§

Source§

impl Debug for Coup

The debug trait has been implemented to support both format and alternate format which means you can print a game instance with:

let mut my_coup = Coup::new(vec![]);
println!("{:?}", my_coup);

and

let mut my_coup = Coup::new(vec![]);
println!("{:#?}", my_coup);
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Coup

§

impl !RefUnwindSafe for Coup

§

impl !Send for Coup

§

impl !Sync for Coup

§

impl Unpin for Coup

§

impl !UnwindSafe for Coup

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V