pub struct Football { /* private fields */ }
Expand description

A representation of the football Andy the Ant lives on.

A football is a truncated icosahedron. Andy lives on the hexagons, of which there are 20. The pentagon-centered stereographic projection from the Wikipedia page is useful to look at to see the graph structure of Andy’s universe (he lives on the yellow faces in that diagram).

In order to model his universe, we can simply use integers from 0 to 20 for each possible face, and define the available transitions manually.

Implementations§

source§

impl Football

source

pub fn new() -> Self

Create a football.

Trait Implementations§

source§

impl RandomWalk for Football

§

type State = i32

The representation of state in this state machine.
source§

fn make_move<R: Rng>(&mut self, rng: &mut R)

Make a random move on the internal state machine.
source§

fn get_state(&self) -> Self::State

Return the current state of the machine.
source§

fn set_state(&mut self, state: Self::State)

Set the state of the internal state machine.
source§

fn walk<R: Rng>( &mut self, src: Self::State, tgt: Self::State, rng: &mut R ) -> u32

Perform a random walk, starting at src, and making random moves until the tgt state is reached. This does not terminate at zero steps if src and tgt are the same, a move is always made first before continuing until tgt. Read more
source§

fn walk_until_limit<R: Rng>( &mut self, src: Self::State, tgt: Self::State, rng: &mut R, limit: u32 ) -> Result<u32, u32>

Same as walk_until, but also takes a limit parameter, specifying the maximum length of the walk we should allow before bailing out. Returns Ok(num_steps) if tgt is reached at or before the limit, and Err(limit) otherwise. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V