Created
December 11, 2014 06:02
-
-
Save kratsg/158bea27c4eec35242cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
lights = [['g','r'], | |
['y','d'], | |
['r','r'], | |
['b','d'], | |
['g','r'], | |
['b','r'], | |
['y','d'], | |
['p','d'], | |
['b','d'], | |
['r','d'], | |
['b','r']] | |
def encoder(items, key, reverse=False): | |
green, yellow, red, blue, purple, right, down = key | |
translateColors = {'g': green, 'y': yellow, 'r': red, 'b': blue, 'p': purple} | |
translatePositions = {'d': down, 'r': right} | |
color, position = items | |
color = translateColors[color] | |
position = translatePositions[position] | |
if reverse: | |
return ('%s%s' % (position, color)).decode('hex') | |
else: | |
return ('%s%s' % (color, position)).decode('hex') | |
from itertools import combinations | |
import re | |
p = re.compile(r'[^\w]') | |
hexList = '0123456789abcdef' | |
for colors in combinations(hexList, 5): | |
for directions in combinations(hexList, 2): | |
firstString = p.sub('', ''.join([encoder(light, colors+directions) for light in lights])) | |
secondString = p.sub('', ''.join([encoder(light, colors+directions, reverse=True) for light in lights])) | |
if len(firstString) == 11 or len(secondString) == 11: | |
print colors+directions | |
print "\t", firstString | |
print "\t", '-'*20 | |
print "\t", secondString | |
print '.'*30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment