Created
April 21, 2016 22:06
-
-
Save mplanchard/9ae35b7871447a2f46b97607b204a6a8 to your computer and use it in GitHub Desktop.
Quick and dirty permutations script
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
from itertools import permutations | |
def get_combinations(layer): | |
possibles = (-layer, -layer + 1, 0, layer - 1, layer) | |
combinations = permutations(possibles, 2) | |
return_combinations = [] | |
for combination in combinations: | |
if layer in combination or -layer in combination: | |
return_combinations.append(combination) | |
return return_combinations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment