-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from jfly/master
Fixes for a few bugs involving AlgorithmBuilder
- Loading branch information
Showing
8 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
import tntdebug | ||
|
||
from puzzle import CubePuzzle | ||
|
||
from net.gnehzr.tnoodle.scrambles import PuzzlePlugins | ||
from net.gnehzr.tnoodle.scrambles import AlgorithmBuilder | ||
from net.gnehzr.tnoodle.scrambles.AlgorithmBuilder import MergingMode | ||
|
||
def main(): | ||
# This test doesn't really belong here, but I don't have a better | ||
# place for it right now. | ||
sixes = CubePuzzle(6) | ||
ab = AlgorithmBuilder(sixes, MergingMode.NO_MERGING) | ||
ab.appendAlgorithm("3Dw2") | ||
assert ab.isRedundant("3Dw2") | ||
scrambleSuccessors = dict(sixes.getSolvedState().getScrambleSuccessors()) | ||
moves = scrambleSuccessors.keys() | ||
assert "3Bw" not in moves | ||
assert "3Lw" not in moves | ||
assert "3Dw" not in moves | ||
|
||
lazyScramblers = dict(PuzzlePlugins.getScramblers()) | ||
for puzzle, lazyScrambler in lazyScramblers.iteritems(): | ||
print "Testing redundant moves on " + puzzle | ||
scrambler = lazyScrambler.cachedInstance() | ||
|
||
for move in scrambler.getSolvedState().getSuccessorsByName(): | ||
ab = AlgorithmBuilder(scrambler, MergingMode.NO_MERGING) | ||
ab.appendAlgorithm(move) | ||
# Right now, it is true to say that for every single WCA puzzle, | ||
# applying the same move twice is redundant. | ||
assert ab.isRedundant(move) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,4 +288,5 @@ public static Random getSeededRandom() { | |
r = new Random(seed.hashCode()); | ||
return r; | ||
} | ||
|
||
} |