Struct andys_morning_stroll::Football
source · 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§
Trait Implementations§
source§impl RandomWalk for Football
impl RandomWalk for Football
source§fn make_move<R: Rng>(&mut self, rng: &mut R)
fn make_move<R: Rng>(&mut self, rng: &mut R)
Make a random move on the internal state machine.
source§fn walk<R: Rng>(
&mut self,
src: Self::State,
tgt: Self::State,
rng: &mut R
) -> u32
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 moresource§fn walk_until_limit<R: Rng>(
&mut self,
src: Self::State,
tgt: Self::State,
rng: &mut R,
limit: u32
) -> Result<u32, u32>
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