Base scaffold
This commit is contained in:
+8
-9
@@ -1,4 +1,4 @@
|
||||
#[derive(Clone,Debug,Copy)]
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
pub enum CellValue {
|
||||
One,
|
||||
Two,
|
||||
@@ -8,20 +8,19 @@ pub enum CellValue {
|
||||
Six,
|
||||
Seven,
|
||||
Eight,
|
||||
Nine
|
||||
Nine,
|
||||
}
|
||||
|
||||
pub struct Cell {
|
||||
value: Option<CellValue>,
|
||||
candidates: Vec<CellValue>,
|
||||
|
||||
}
|
||||
|
||||
impl Default for Cell {
|
||||
fn default() -> Cell {
|
||||
Cell {
|
||||
value : None,
|
||||
candidates : vec![
|
||||
value: None,
|
||||
candidates: vec![
|
||||
CellValue::One,
|
||||
CellValue::Two,
|
||||
CellValue::Three,
|
||||
@@ -30,19 +29,19 @@ impl Default for Cell {
|
||||
CellValue::Six,
|
||||
CellValue::Seven,
|
||||
CellValue::Eight,
|
||||
CellValue::Nine
|
||||
]
|
||||
CellValue::Nine,
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Board {
|
||||
cells: [ [ Cell ; 9 ] ; 9 ]
|
||||
cells: [[Cell; 9]; 9],
|
||||
}
|
||||
|
||||
impl Board {
|
||||
fn value(self, x: usize, y : usize) -> Option<CellValue> {
|
||||
fn value(self, x: usize, y: usize) -> Option<CellValue> {
|
||||
self.cells[x][y].value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user