Created
September 23, 2016 09:13
-
-
Save DeastinY/7d605d692ce8cb26e12c5dfcbbedca92 to your computer and use it in GitHub Desktop.
TOH State Generation
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
def unique(iterable): | |
# http://stackoverflow.com/questions/6534430/why-does-pythons-itertools-permutations-contain-duplicates-when-the-original | |
seen = set() | |
for i in iterable: | |
if str(i) in seen: | |
continue | |
seen.add(str(i)) | |
yield i | |
states = [i for i in unique(itertools.permutations([[2,1],[],[]]))] + \ | |
[i for i in unique(itertools.permutations([[2],[1],[]]))] + \ | |
[i for i in unique(itertools.permutations([[1,2],[],[]]))] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment