|
1 | 1 | use super::board::Board; |
2 | 2 | use super::candidates::Candidates; |
3 | 3 | use super::masks::Masks; |
4 | | -use bitflags::bitflags; |
5 | 4 |
|
| 5 | +mod flags; |
6 | 6 | mod hidden_pairs; |
7 | 7 | mod hidden_singles; |
8 | 8 | mod locked_candidates; |
9 | 9 | mod naked_pairs; |
10 | 10 | mod naked_singles; |
11 | 11 | mod x_wing; |
12 | 12 |
|
| 13 | +pub use flags::TechniqueFlags; |
13 | 14 | use hidden_pairs::HiddenPairs; |
14 | 15 | use hidden_singles::HiddenSingles; |
15 | 16 | use locked_candidates::LockedCandidates; |
16 | 17 | use naked_pairs::NakedPairs; |
17 | 18 | use naked_singles::NakedSingles; |
18 | 19 | use x_wing::XWing; |
19 | 20 |
|
20 | | -bitflags! { |
21 | | - /// Bitmask to control which human techniques are applied. |
22 | | - #[repr(transparent)] |
23 | | - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
24 | | - pub struct TechniqueFlags: u16 { |
25 | | - /// Apply the naked singles technique. |
26 | | - const NAKED_SINGLES = 1 << 0; |
27 | | - /// Apply the hidden singles technique. |
28 | | - const HIDDEN_SINGLES = 1 << 1; |
29 | | - /// Apply the naked pairs technique. |
30 | | - const NAKED_PAIRS = 1 << 2; |
31 | | - /// Apply the hidden pairs technique. |
32 | | - const HIDDEN_PAIRS = 1 << 3; |
33 | | - /// Apply the locked candidates technique. |
34 | | - const LOCKED_CANDIDATES = 1 << 4; |
35 | | - /// Apply the X-Wing technique. |
36 | | - const XWING = 1 << 5; |
37 | | - |
38 | | - /// Apply easy techniques like naked singles and hidden singles. |
39 | | - const EASY = Self::NAKED_SINGLES.bits() | Self::HIDDEN_SINGLES.bits(); |
40 | | - /// Apply medium techniques like naked pairs and hidden pairs. |
41 | | - const MEDIUM = Self::NAKED_PAIRS.bits() | Self::HIDDEN_PAIRS.bits(); |
42 | | - /// Apply hard techniques like locked candidates and X-Wings. |
43 | | - const HARD = Self::LOCKED_CANDIDATES.bits() | Self::XWING.bits(); |
44 | | - } |
45 | | -} |
46 | | - |
47 | 21 | // Now the actual implementation of the techniques, these would operate on |
48 | 22 | // references to Board, Masks, and CandidatesCache. |
49 | 23 | pub struct TechniquePropagator<'a> { |
|
0 commit comments