<commit_before>mod solver;
mod generator;

pub use self::solver::*;
pub use self::generator::*;

#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Clue(pub i32);

const NO_CLUE: Clue = Clue(0);

use super::{Grid, Y, X, Coord};

#[derive(Clone)]
pub struct LinePlacement {
    right: Grid<bool>,
    down: Grid<bool>,
}

impl LinePlacement {
    pub fn new(height: i32, width: i32) -> LinePlacement {
        LinePlacement {
            right: Grid::new(height, width - 1, false),
            down: Grid::new(height - 1, width, false),
        }
    }
    pub fn right(&self, cd: Coord) -> bool {
        self.right.is_valid_coord(cd) && self.right[cd]
    }
    pub fn set_right(&mut self, cd: Coord, e: bool) {
        self.right[cd] = e;
    }
    pub fn down(&self, cd: Coord) -> bool {
        self.down.is_valid_coord(cd) && self.down[cd]
    }
    pub fn set_down(&mut self, cd: Coord, e: bool) {
        self.down[cd] = e;
    }
}<commit_msg>Numberlink: add isolated to LinePlacement<commit_after>mod solver;
mod generator;

pub use self::solver::*;
pub use self::generator::*;

#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Clue(pub i32);

const NO_CLUE: Clue = Clue(0);

use super::{Grid, Y, X, Coord};

#[derive(Clone)]
pub struct LinePlacement {
    right: Grid<bool>,
    down: Grid<bool>,
}

impl LinePlacement {
    pub fn new(height: i32, width: i32) -> LinePlacement {
        LinePlacement {
            right: Grid::new(height, width - 1, false),
            down: Grid::new(height - 1, width, false),
        }
    }
    pub fn right(&self, cd: Coord) -> bool {
        self.right.is_valid_coord(cd) && self.right[cd]
    }
    pub fn set_right(&mut self, cd: Coord, e: bool) {
        self.right[cd] = e;
    }
    pub fn down(&self, cd: Coord) -> bool {
        self.down.is_valid_coord(cd) && self.down[cd]
    }
    pub fn set_down(&mut self, cd: Coord, e: bool) {
        self.down[cd] = e;
    }
    pub fn isolated(&self, cd: Coord) -> bool {
        let (Y(y), X(x)) = cd;
        !(self.right((Y(y), X(x - 1))) || self.right((Y(y), X(x))) || self.down((Y(y - 1), X(x))) || self.down((Y(y), X(x))))
    }
}
{'fraction_non_alphanumeric': 0.17423887587822015, 'fraction_numerical': 0.00936768149882904, 'mean_word_length': 2.714782608695652, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6399307', 'n_tokens_mistral': 790, 'n_tokens_neox': 788, 'n_words': 206}