Created
April 13, 2013 21:26
-
-
Save dmbaturin/5380143 to your computer and use it in GitHub Desktop.
attach tohou titles to developer roles
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
#!/usr/bin/env python | |
import random | |
class ThCredits: | |
""" Attaches fancy titles to developer roles """ | |
_epithets = [ | |
"nine-tailed %s", | |
"ordinary %s", | |
"perfect and elegant %s", | |
"%s hiding in the darkness", | |
"the %s of knowledge and shade", | |
"hyperactive monster %s", | |
"superficially busy %s", | |
"%s that lurks in the boundary", | |
"traditional %s of fantasy", | |
"%s of the riverside mist", | |
"supreme %s of paradise", | |
"horizontal thinking %s" | |
] | |
@classmethod | |
def attach(self, developers): | |
""" Returns developrs list with titles attached """ | |
epithet_index = 0 | |
previous_epithet_index = 0 | |
epithets_number = len(self._epithets) - 1 | |
for name in developers: | |
while True: | |
epithet_index = random.randint(0, epithets_number) | |
if (epithet_index != previous_epithet_index): | |
developers[name] = self._epithets[epithet_index] % developers[name] | |
previous_epithet_index = epithet_index | |
break | |
return developers | |
# Usage example: | |
# developers = {"Joe": "architect", "Fred": "programmer", "Mary": "QA specialist", "Alice": "technical writer"} | |
# developers = ThCredits.attach(developers) | |
# print developers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment