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>Implementations§
Source§impl Nonogram
row_segments and column_segments are in the form of a
impl Nonogram
row_segments and column_segments are in the form of a
Sourcepub fn generate(width: usize, height: usize) -> Nonogram
pub fn generate(width: usize, height: usize) -> Nonogram
Generates a random nonogram with the given dimensions.
The generated puzzle is not checked for solvability.
Sourcepub fn solvable(&self) -> bool
pub fn solvable(&self) -> bool
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.
Sourcepub fn generate_checksum(&self) -> u64
pub fn generate_checksum(&self) -> u64
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.
Sourcepub fn as_json(&self) -> Result<String, JsonError>
pub fn as_json(&self) -> Result<String, JsonError>
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>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Nonogram
impl<'de> Deserialize<'de> for Nonogram
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for Nonogram
Auto Trait Implementations§
impl Freeze for Nonogram
impl RefUnwindSafe for Nonogram
impl Send for Nonogram
impl Sync for Nonogram
impl Unpin for Nonogram
impl UnwindSafe for Nonogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more