Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
The 88th Puzzle solution in Uncategorized category for The 88th Puzzle by capback250
valid = [1, 2, 1, 0, 2, 0, 0, 3, 0, 4, 3, 4]
rotate1 = lambda cors: [[cors[2], cors[1], cors[5], cors[0], cors[4], cors[3]] + cors[6:], '1']
rotate2 = lambda cors: [[cors[0], cors[3], cors[2], cors[6], cors[1], cors[5], cors[4]] + cors[7:], '2']
rotate3 = lambda cors: [cors[:5] + [cors[7], cors[6], cors[10], cors[5], cors[9], cors[8], cors[11]], '3']
rotate4 = lambda cors: [cors[:6] + [cors[8], cors[7], cors[11], cors[6], cors[10], cors[9]], '4']
def puzzle88(cors):
checked, curr, queqe = [], [], []
queqe.append([list(cors), ''])
while 1:
current, path = queqe.pop()
checked.append(current)
if current == valid:
return str(path[::-1])
for action in [rotate1, rotate2, rotate3, rotate4]:
new = action(current)
if new[0] not in checked and new[0] not in curr:
curr.append(new[0])
queqe.insert(0, [new[0], new[1] + path])
Feb. 16, 2016