Skip to content

Commit

Permalink
Always use postmoves when obfuscating user algs
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-yu committed Jun 14, 2024
1 parent 6a4fc0b commit cb95945
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions js/RubiksCube.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,19 @@ function generateAlgScramble(raw_alg,set,obfuscateAlg,shouldPrescramble){
rc.doAlgorithm(drScramble);
return obfuscate(drScramble + rc.wcaOrient() + alg.cube.invert(raw_alg), numPremoves=3, minLength=13, numPostmoves=5);
default:
return obfuscate(alg.cube.invert(raw_alg));

let inverse = alg.cube.invert(raw_alg);
if (document.getElementById("userDefined").checked){
// postmoves and premoves should be used when the algset is unknown
// Ensures that it shuold be hard to guess the solution even for
// unusual and unexpected use cases
return obfuscate(inverse, numPremoves=3, minLength=13, numPostmoves=3);
}
else {
// Use only premoves by default to save time
// TODO: it may be worth researching this
return obfuscate(inverse);
}
}

}
Expand All @@ -989,7 +1001,18 @@ function generatePreScramble(raw_alg, generator, times, obfuscateAlg, premoves="
scramble += alg.cube.invert(raw_alg);

if (obfuscateAlg){
return obfuscate(scramble);

if (document.getElementById("userDefined").checked){
// postmoves and premoves should be used when the algset is unknown
// Ensures that it shuold be hard to guess the solution even for
// unusual and unexpected use cases
return obfuscate(scramble, numPremoves=3, minLength=13, numPostmoves=3);
}
else {
// Use only premoves by default to save time
// TODO: it may be worth researching this
return obfuscate(scramble);
}
}
else {
return scramble;
Expand Down

0 comments on commit cb95945

Please sign in to comment.