Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Rotate Hole solution in Speedy category for Rotate Hole by IRONKAGE
def rotate(state, pipe_numbers):
return [i for i in range(len(state)) if all(state[n - i] for n in pipe_numbers)]
if __name__ == '__main__':
assert rotate([1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1], [0, 1]) == [1, 8], "Example"
assert rotate([1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1], [0, 1, 2]) == [], "Mission impossible"
assert rotate([1, 0, 0, 0, 1, 1, 0, 1], [0, 4, 5]) == [0], "Don't touch it"
assert rotate([1, 0, 0, 0, 1, 1, 0, 1], [5, 4, 5]) == [0, 5], "Two cannonballs in the same pipe"
Sept. 27, 2019
Comments: