Skip to content

Instantly share code, notes, and snippets.

@smeschke
Created March 29, 2019 20:22
Show Gist options
  • Select an option

  • Save smeschke/a6adbecdc9e4dd8284297d9cac2931be to your computer and use it in GitHub Desktop.

Select an option

Save smeschke/a6adbecdc9e4dd8284297d9cac2931be to your computer and use it in GitHub Desktop.
Generate Siteswaps
#Takes an integer and returns a siteswap character
def get_char(height):
# If the height is under 10, return the string on the height
if height < 10: return str(height)
# If the height is over 10, return 'a' for 10, 'b' for 11, etc...
else: return chr(height + 87)
# One ball goes high and the others low
for num_balls in range(3,6):
for height in range(6):
siteswap = get_char(height + num_balls)
for beat in range(height):
siteswap += get_char(num_balls-1)
print(siteswap)
print('----------------------------------------')
# High Low Middle
for num_balls in range(3,9):
siteswap = get_char(num_balls+1)
siteswap += get_char(num_balls-1)
siteswap += get_char(num_balls)
print(siteswap)
print('----------------------------------------')
# Training for a cascade of n+1 balls
for num_balls in range(2,6):
num_balls = num_balls * 2
siteswap = ''
for beat in range(num_balls-2):
siteswap += get_char(num_balls+1)
siteswap += '2'
print(siteswap)
print('----------------------------------------')
# Tower Patterns
for num_balls in range(3,9):
siteswap = ''
height = num_balls * 2 - 1
while height > 0:
siteswap += get_char(height)
height -= 2
print(siteswap)
print('----------------------------------------')
# Shower patterns
for num_balls in range(3, 8):
siteswap = ''
siteswap += get_char(num_balls*2-1)
siteswap += '1'
print(siteswap)
print('----------------------------------------')
# Patterns with high crossing, low self
for num_balls in range(2, 7):
num_balls = num_balls * 2 -1
siteswap = get_char(num_balls+1)
siteswap += 'x'
siteswap += get_char(num_balls-1)
print(siteswap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment