Basic knowledge of self and regions
This commit is contained in:
+2
-62
@@ -1,62 +1,2 @@
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
pub enum CellValue {
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Four,
|
||||
Five,
|
||||
Six,
|
||||
Seven,
|
||||
Eight,
|
||||
Nine,
|
||||
}
|
||||
|
||||
pub struct Cell {
|
||||
value: Option<CellValue>,
|
||||
candidates: Vec<CellValue>,
|
||||
}
|
||||
|
||||
impl Default for Cell {
|
||||
fn default() -> Cell {
|
||||
Cell {
|
||||
value: None,
|
||||
candidates: vec![
|
||||
CellValue::One,
|
||||
CellValue::Two,
|
||||
CellValue::Three,
|
||||
CellValue::Four,
|
||||
CellValue::Five,
|
||||
CellValue::Six,
|
||||
CellValue::Seven,
|
||||
CellValue::Eight,
|
||||
CellValue::Nine,
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Board {
|
||||
cells: [[Cell; 9]; 9],
|
||||
}
|
||||
|
||||
impl Board {
|
||||
fn value(self, x: usize, y: usize) -> Option<CellValue> {
|
||||
self.cells[x][y].value
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
pub mod cell;
|
||||
pub mod board;
|
||||
|
||||
Reference in New Issue
Block a user