Skip to main content

rustoku_lib/core/techniques/
flags.rs

1use bitflags::bitflags;
2
3bitflags! {
4    /// Bitflags indicating which human techniques are active/enabled.
5    ///
6    /// The flags are organized into bytes for better organization:
7    /// - Easy techniques from bits 0-7
8    /// - Medium techniques from bits 8-15
9    /// - Hard techniques from bits 16-23
10    /// - Expert techniques from bits 24-31
11    ///
12    /// Composite groups (EASY, MEDIUM, HARD, EXPERT) are here for convenience.
13    #[repr(transparent)]
14    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15    pub struct TechniqueFlags: u32 {
16        /// Apply the naked singles technique.
17        const NAKED_SINGLES = 1 << 0;
18        /// Apply the hidden singles technique.
19        const HIDDEN_SINGLES = 1 << 1;
20
21        /// Apply the naked pairs technique.
22        const NAKED_PAIRS = 1 << 8;
23        /// Apply the hidden pairs technique.
24        const HIDDEN_PAIRS = 1 << 9;
25        /// Apply the locked candidates technique.
26        const LOCKED_CANDIDATES = 1 << 10;
27        /// Apply the naked triples technique.
28        const NAKED_TRIPLES = 1 << 11;
29        /// Apply the hidden triples technique.
30        const HIDDEN_TRIPLES = 1 << 12;
31
32        /// Apply the X-Wing technique.
33        const X_WING = 1 << 16;
34        /// Apply the naked quads technique.
35        const NAKED_QUADS = 1 << 17;
36        /// Apply the hidden quads technique.
37        const HIDDEN_QUADS = 1 << 18;
38        /// Apply the Swordfish technique.
39        const SWORDFISH = 1 << 19;
40        /// Apply the Jellyfish technique.
41        const JELLYFISH = 1 << 20;
42        /// Apply the Skyscraper technique.
43        const SKYSCRAPER = 1 << 21;
44
45        /// Apply the W-Wing technique.
46        const W_WING = 1 << 24;
47        /// Apply the XY-Wing technique.
48        const XY_WING = 1 << 25;
49        /// Apply the XYZ-Wing technique.
50        const XYZ_WING = 1 << 26;
51
52        /// Alias for X_WING.
53        #[deprecated(note = "use X_WING instead")]
54        const XWING = Self::X_WING.bits();
55
56        /// Apply easy techniques
57        const EASY = 0x0000_00FF;
58        /// Apply medium techniques
59        const MEDIUM = 0x0000_FF00;
60        /// Apply hard techniques
61        const HARD = 0x00FF_0000;
62        /// Apply expert techniques
63        const EXPERT = 0xFF00_0000;
64    }
65}