[−][src]Struct minotaur::Grid
Methods
impl Grid
[src]
pub fn new(width: usize, height: usize) -> Grid
[src]
pub fn binary_tree(&mut self, seed: Option<u64>)
[src]
binary_tree populates the maze according to the following algorithm: Arbitrarily visit every cell, choosing NORTH or EAST as follows:
If both NORTH and EAST are valid, choose one direction randomly If only NORTH is valid, choose it 100% of the time If only EAST is valid, choose it 100% of the time
After choosing a direction, link this cell with its neighbor in that direction
The only cell that will not have a valid direction to choose from is the northeastern corner.
pub fn sidewinder(&mut self, seed: Option<u64>)
[src]
sidewinder populates the maze according to the following algorithm: Start with a cell on the western column. This cell starts a local "run."
Choose NORTH or EAST as follows: If both NORTH and EAST are valid, choose one direction randomly If only NORTH is valid, choose it 100% of the time If only EAST is valid, choose it 100% of the time
After choosing a direction, if EAST was chosen, link this cell with its neighbor in that direction. The EASTERN neighbor is then added to the local run and a direction is chosen for it. But if NORTH was chosen, then select at random one of the cells from the local run and link it with its NORTHERN neighbor. The local run is reset. Continue from the EASTERN neighbor.
pub fn aldous_broder(&mut self, seed: Option<u64>)
[src]
aldous_broder populates a maze in an unbiased way. Basically, first, a cell is chosen at random and considered "visited." Travel in a random direction. If the next cell is "unvisited", then link the two cells. Continue until all cells have been visited.
pub fn wilsons(&mut self, seed: Option<u64>)
[src]
wilsons populates a maze in an unbiased way. First, some random cell is set to be "visited." Then, some other random cell is "started." From there, travel randomly until you hit a "visited" cell. Once you hit a "visited" cell, connect all the links from the "started" cell. Then start over, choosing a new "unvisited" cell.
The trick is that there is a "loop removal" step. So while looking for a "visited" cell, if you loop back to a cell you've travelling through this run, then remove the loop you just made.
pub fn hunt_and_kill(&mut self, seed: Option<u64>)
[src]
pub fn recursive_backtracker(&mut self, seed: Option<u64>)
[src]
pub fn to_image(
&self,
cell_size: usize,
wall_size: usize,
background_pixel: Rgb<u8>,
wall_pixel: Rgb<u8>
) -> RgbImage
[src]
&self,
cell_size: usize,
wall_size: usize,
background_pixel: Rgb<u8>,
wall_pixel: Rgb<u8>
) -> RgbImage
Trait Implementations
impl PartialEq<Grid> for Grid
[src]
impl Display for Grid
[src]
impl Debug for Grid
[src]
impl Serialize for Grid
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Grid
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Sync for Grid
impl Send for Grid
impl Unpin for Grid
impl RefUnwindSafe for Grid
impl UnwindSafe for Grid
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,