Skip to content

Commit e4abdaf

Browse files
committed
Rename key variable in various techniques
1 parent b5c82a9 commit e4abdaf

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

rustoku-lib/src/core/techniques/hidden_pairs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl HiddenPairs {
1313
path: &mut SolvePath,
1414
flags: TechniqueFlags,
1515
) -> bool {
16-
let mut unit_placements_made = false;
16+
let mut eliminations_made = false;
1717

1818
for n1_val in 1..=9 {
1919
for n2_val in (n1_val + 1)..=9 {
@@ -50,7 +50,7 @@ impl HiddenPairs {
5050
let elimination_mask1 = current_mask1 & !pair_mask;
5151

5252
if elimination_mask1 != 0 {
53-
unit_placements_made |= prop.eliminate_multiple_candidates(
53+
eliminations_made |= prop.eliminate_multiple_candidates(
5454
r1,
5555
c1,
5656
elimination_mask1,
@@ -64,7 +64,7 @@ impl HiddenPairs {
6464
let elimination_mask2 = current_mask2 & !pair_mask;
6565

6666
if elimination_mask2 != 0 {
67-
unit_placements_made |= prop.eliminate_multiple_candidates(
67+
eliminations_made |= prop.eliminate_multiple_candidates(
6868
r2,
6969
c2,
7070
elimination_mask2,
@@ -75,7 +75,7 @@ impl HiddenPairs {
7575
}
7676
}
7777
}
78-
unit_placements_made
78+
eliminations_made
7979
}
8080
}
8181

rustoku-lib/src/core/techniques/locked_candidates.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl LockedCandidates {
1414
path: &mut SolvePath,
1515
flags: TechniqueFlags,
1616
) -> bool {
17-
let mut placements_made = false;
17+
let mut eliminations_made = false;
1818

1919
for candidate in 1..=9 {
2020
let candidate_bit = 1 << (candidate - 1);
@@ -41,15 +41,15 @@ impl LockedCandidates {
4141
if r != row && prop.board.is_empty(r, c) {
4242
let initial_mask = prop.candidates.get(r, c);
4343
if (initial_mask & candidate_bit) != 0 {
44-
placements_made |=
44+
eliminations_made |=
4545
prop.eliminate_candidate(r, c, candidate_bit, flags, path);
4646
}
4747
}
4848
}
4949
}
5050
}
5151
}
52-
placements_made
52+
eliminations_made
5353
}
5454

5555
// Helper function for Locked Candidates (column), private to this impl block
@@ -59,7 +59,7 @@ impl LockedCandidates {
5959
path: &mut SolvePath,
6060
flags: TechniqueFlags,
6161
) -> bool {
62-
let mut placements_made = false;
62+
let mut eliminations_made = false;
6363

6464
for candidate in 1..=9 {
6565
let candidate_bit = 1 << (candidate - 1);
@@ -86,15 +86,15 @@ impl LockedCandidates {
8686
if c != col && prop.board.is_empty(r, c) {
8787
let initial_mask = prop.candidates.get(r, c);
8888
if (initial_mask & candidate_bit) != 0 {
89-
placements_made |=
89+
eliminations_made |=
9090
prop.eliminate_candidate(r, c, candidate_bit, flags, path);
9191
}
9292
}
9393
}
9494
}
9595
}
9696
}
97-
placements_made
97+
eliminations_made
9898
}
9999

100100
// Helper function for Locked Candidates (box), private to this impl block
@@ -104,7 +104,7 @@ impl LockedCandidates {
104104
path: &mut SolvePath,
105105
flags: TechniqueFlags,
106106
) -> bool {
107-
let mut placements_made = false;
107+
let mut eliminations_made = false;
108108
let start_row = (box_idx / 3) * 3;
109109
let start_col = (box_idx % 3) * 3;
110110

@@ -132,7 +132,7 @@ impl LockedCandidates {
132132
if (c < start_col || c >= start_col + 3) && prop.board.is_empty(row, c) {
133133
let initial_mask = prop.candidates.get(row, c);
134134
if (initial_mask & candidate_bit) != 0 {
135-
placements_made |=
135+
eliminations_made |=
136136
prop.eliminate_candidate(row, c, candidate_bit, flags, path);
137137
}
138138
}
@@ -148,40 +148,40 @@ impl LockedCandidates {
148148
if (r < start_row || r >= start_row + 3) && prop.board.is_empty(r, col) {
149149
let initial_mask = prop.candidates.get(r, col);
150150
if (initial_mask & candidate_bit) != 0 {
151-
placements_made |=
151+
eliminations_made |=
152152
prop.eliminate_candidate(r, col, candidate_bit, flags, path);
153153
}
154154
}
155155
}
156156
}
157157
}
158-
placements_made
158+
eliminations_made
159159
}
160160
}
161161

162162
impl TechniqueRule for LockedCandidates {
163163
fn apply(&self, prop: &mut TechniquePropagator, path: &mut SolvePath) -> bool {
164-
let mut overall_placements_made = false;
164+
let mut overall_eliminations_made = false;
165165

166166
// Check rows for pointing pairs/triples
167167
for row in 0..9 {
168-
overall_placements_made |=
168+
overall_eliminations_made |=
169169
Self::process_row_for_locked_candidates(prop, row, path, self.flags());
170170
}
171171

172172
// Check columns for pointing pairs/triples
173173
for col in 0..9 {
174-
overall_placements_made |=
174+
overall_eliminations_made |=
175175
Self::process_col_for_locked_candidates(prop, col, path, self.flags());
176176
}
177177

178178
// Check boxes for box/line reduction
179179
for box_idx in 0..9 {
180-
overall_placements_made |=
180+
overall_eliminations_made |=
181181
Self::process_box_for_locked_candidates(prop, box_idx, path, self.flags());
182182
}
183183

184-
overall_placements_made
184+
overall_eliminations_made
185185
}
186186

187187
fn flags(&self) -> crate::core::TechniqueFlags {

rustoku-lib/src/core/techniques/x_wing.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct XWing;
77

88
impl TechniqueRule for XWing {
99
fn apply(&self, prop: &mut TechniquePropagator, path: &mut SolvePath) -> bool {
10-
let mut placements_made = false;
10+
let mut eliminations_made = false;
1111

1212
for candidate_val in 1..=9 {
1313
let candidate_bit = 1 << (candidate_val - 1);
@@ -47,7 +47,7 @@ impl TechniqueRule for XWing {
4747
if r_other != r1 && r_other != r2 && prop.board.is_empty(r_other, c1) {
4848
let initial_mask = prop.candidates.get(r_other, c1);
4949
if (initial_mask & candidate_bit) != 0 {
50-
placements_made |= prop.eliminate_candidate(
50+
eliminations_made |= prop.eliminate_candidate(
5151
r_other,
5252
c1,
5353
candidate_bit,
@@ -63,7 +63,7 @@ impl TechniqueRule for XWing {
6363
if r_other != r1 && r_other != r2 && prop.board.is_empty(r_other, c2) {
6464
let initial_mask = prop.candidates.get(r_other, c2);
6565
if (initial_mask & candidate_bit) != 0 {
66-
placements_made |= prop.eliminate_candidate(
66+
eliminations_made |= prop.eliminate_candidate(
6767
r_other,
6868
c2,
6969
candidate_bit,
@@ -112,7 +112,7 @@ impl TechniqueRule for XWing {
112112
if c_other != c1 && c_other != c2 && prop.board.is_empty(r1, c_other) {
113113
let initial_mask = prop.candidates.get(r1, c_other);
114114
if (initial_mask & candidate_bit) != 0 {
115-
placements_made |= prop.eliminate_candidate(
115+
eliminations_made |= prop.eliminate_candidate(
116116
r1,
117117
c_other,
118118
candidate_bit,
@@ -128,7 +128,7 @@ impl TechniqueRule for XWing {
128128
if c_other != c1 && c_other != c2 && prop.board.is_empty(r2, c_other) {
129129
let initial_mask = prop.candidates.get(r2, c_other);
130130
if (initial_mask & candidate_bit) != 0 {
131-
placements_made |= prop.eliminate_candidate(
131+
eliminations_made |= prop.eliminate_candidate(
132132
r2,
133133
c_other,
134134
candidate_bit,
@@ -142,7 +142,7 @@ impl TechniqueRule for XWing {
142142
}
143143
}
144144
}
145-
placements_made
145+
eliminations_made
146146
}
147147

148148
fn flags(&self) -> crate::core::TechniqueFlags {

0 commit comments

Comments
 (0)