Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array = ["a", "_", "_", "_", "_", "_" ,"_", "_"]
- ConveyDict = {"a":"move", "b":"move", "c":"move", "d":"move", "e":"move", "f":"move", "g":"move", "h":"move", "X":"stop", "_":"apply"}
- def show(array):
- print array[0] + array[1] + array[2]
- print array[7] + "*" + array[3]
- print array[6] + array[5] + array[4]
- def rotate(array):
- wip = ["_", "_", "_", "_", "_", "_" ,"_", "_"]
- final = ["_", "_", "_", "_", "_", "_" ,"_", "_"]
- start = 0 #Where we're at in the array as far as what's been determined
- chunks = []
- for a in range(0,8):
- if ConveyDict[array[a]] == "stop":
- #Write chunk to final array
- #print "Writing ("+ str(start) + "-" + str(a+1) + ") via stop"
- for temp in range(start,a+1):
- final[temp] = array[temp]
- start = a+1
- elif ConveyDict[array[a]] == "apply":
- #Write chunk to final array
- #print "Writing ("+ str(start) + "-" + str(a+1) + ") via apply"
- for temp in range(start,a+1):
- if temp+1 == 8:
- final[0] = array[7]
- else:
- final[temp+1] = array[temp]
- start = a+1
- else:
- if a == 7:
- if ConveyDict[final[0]] == "apply":
- #print "Writing ("+ str(start) + "-" + str(a+1) + ") via wraparound apply"
- for temp in range(start,a+1):
- if temp+1 == 8:
- final[0] = array[7]
- else:
- final[temp+1] = array[temp]
- start = a+1
- else:
- #print "Writing ("+ str(start) + "-" + str(a+1) + ") via wraparound stop"
- for temp in range(start,a+1):
- final[temp] = array[temp]
- start = a+1
- return final
- show(array)
- print "\n"
- a = raw_input()
- for blah in xrange(0,10):
- array = rotate(array)
- show(array)
- a = raw_input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement