1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
extern crate bit_set;
use std::ops::Index;
pub use constraint::Constraint;
pub use puzzle::Puzzle;
pub use puzzle::PuzzleSearch;
#[derive(Copy,Clone,Debug,Eq,PartialEq)]
pub struct VarToken(usize);
pub type Val = i32;
#[derive(Debug)]
pub struct Solution {
vars: Vec<Val>,
}
pub mod constraint;
mod puzzle;
impl Index<VarToken> for Solution {
type Output = Val;
fn index(&self, var: VarToken) -> &Val {
let VarToken(idx) = var;
&self.vars[idx]
}
}