[][src]Struct nonogram::Nonogram

pub struct Nonogram {
    pub row_segments: Array1<Vec<usize>>,
    pub column_segments: Array1<Vec<usize>>,
    pub completed_grid: Array2<u8>,
}

Fields

row_segments: Array1<Vec<usize>>column_segments: Array1<Vec<usize>>completed_grid: Array2<u8>

Methods

impl Nonogram[src]

row_segments and column_segments are in the form of a

pub fn generate(width: usize, height: usize) -> Nonogram[src]

Generates a random nonogram with the given dimensions.

The generated puzzle is not checked for solvability.

pub fn height(&self) -> usize[src]

Provides the height of the puzzle.

pub fn width(&self) -> usize[src]

Provides the width of the puzzle.

pub fn solvable(&self) -> bool[src]

Determines whether or not the puzzle is solvable.

This method attempts to programmatically solve the puzzle. If it reaches a dead-end the method returns false. Otherwise it reaches the conclusion of the puzzle and returns true.

pub fn generate_checksum(&self) -> u64[src]

Generates a checksum for quickly determining equivalence between puzzles of like dimensions.

This is not meant to check equivalence between all puzzles, only those with the same dimensions. This function is meant for cross-platform checks for equivalence in those situations.

pub fn as_json(&self) -> Result<String, JsonError>[src]

Serializes the nonogram as json so that we don't need to use serde every time we need to use it

pub fn from_json(serialized: &str) -> Result<Nonogram, String>[src]

Trait Implementations

impl PartialEq<Nonogram> for Nonogram[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Eq for Nonogram[src]

impl Debug for Nonogram[src]

impl Hash for Nonogram[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'de> Deserialize<'de> for Nonogram[src]

impl Serialize for Nonogram[src]

Auto Trait Implementations

impl Send for Nonogram

impl Sync for Nonogram

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]