Skip to content

Instantly share code, notes, and snippets.

@WisdomWolf
Created May 22, 2020 21:05
Show Gist options
  • Save WisdomWolf/082d5e0f2b47345a6ac675c6a8ebae52 to your computer and use it in GitHub Desktop.
Save WisdomWolf/082d5e0f2b47345a6ac675c6a8ebae52 to your computer and use it in GitHub Desktop.
Slay The Spire Seed Conversion Functions
def convert_seed_to_string(seed: int) -> str:
"""Converts numeric seed from run file to alphanumeric seed"""
char_string = string.digits + string.ascii_uppercase
# Convert to unsigned
leftover = seed = seed + 2**64 if seed < 0 else seed
char_count = len(char_string)
result = []
while leftover != 0:
remainder = leftover % char_count
leftover = leftover // char_count
index = int(remainder)
c = char_string[index]
result.insert(0, c)
return ''.join(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment