Skip to content

Commit

Permalink
Add CHECK_META_CENTER_PARITY.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jan 31, 2024
1 parent bbe181e commit 66152d1
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions src/rs/scramble/puzzles/cube4x4x4/phase2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ fn is_solve_center_center_case(case: &[[SideCenter; 4]; 2]) -> bool {
false
}

const SHORT_CIRCUIT_REJECTION: bool = false;
const CHECK_META_CENTER_PARITY: bool = true;
const SHORT_CIRCUIT_REJECTION: bool = true;
const COUNT_MULTIPLE_KNOWN_PAIR_REJECTION_PER_PATTERN: bool = true;

impl ReplacementSolutionCondition<Phase2Puzzle, Phase2SymmetryTables>
Expand Down Expand Up @@ -295,7 +296,7 @@ impl ReplacementSolutionCondition<Phase2Puzzle, Phase2SymmetryTables>
// };

let kpuzzle_4x4x4 = self.phase2_search_full_pattern.kpuzzle();
let mut accept;
let mut accept = false;

// TODO: the rest of this function is old code ported to a new implementation. We can probably make this simpler.

Expand All @@ -310,29 +311,31 @@ impl ReplacementSolutionCondition<Phase2Puzzle, Phase2SymmetryTables>

/******** Centers ********/

// TODO: is it more efficient to check this later?

let centers_orbit_info = &kpuzzle_4x4x4.data.ordered_orbit_info[2];
assert!(centers_orbit_info.name == "CENTERS".into());

let piece_at_index_0 = pattern_with_alg_applied.get_piece(centers_orbit_info, 0);
// for i in 0..24 {
// print!(
// ",{}",
// pattern_with_alg_applied.get_piece(centers_orbit_info, i)
// );
// stdout().flush();
// }
// dbg!(piece_at_index_0);
accept = !(4..20).contains(&piece_at_index_0);

if !accept {
// println!("Rejecting due to centers");
{
self._debug_num_centers_rejected += 1;
}
if SHORT_CIRCUIT_REJECTION {
return false;
if CHECK_META_CENTER_PARITY {
// TODO: is it more efficient to check this later?

let centers_orbit_info = &kpuzzle_4x4x4.data.ordered_orbit_info[2];
assert!(centers_orbit_info.name == "CENTERS".into());

let piece_at_index_0 = pattern_with_alg_applied.get_piece(centers_orbit_info, 0);
// for i in 0..24 {
// print!(
// ",{}",
// pattern_with_alg_applied.get_piece(centers_orbit_info, i)
// );
// stdout().flush();
// }
// dbg!(piece_at_index_0);
accept = !(4..20).contains(&piece_at_index_0);

if !accept {
// println!("Rejecting due to centers");
{
self._debug_num_centers_rejected += 1;
}
if SHORT_CIRCUIT_REJECTION {
return false;
}
}
}

Expand Down

0 comments on commit 66152d1

Please sign in to comment.