More color. More cheek.
This commit is contained in:
parent
10e57f0935
commit
2c0f741b95
30
f8ball.py
30
f8ball.py
|
|
@ -27,17 +27,39 @@ def magic_fate_ball():
|
||||||
"Outlook Good!",
|
"Outlook Good!",
|
||||||
"Well, if it feels right...",
|
"Well, if it feels right...",
|
||||||
"Don't bet the farm on it.",
|
"Don't bet the farm on it.",
|
||||||
"This is The Way."
|
"This is The Way.",
|
||||||
|
"Go get 'em, Tiger!",
|
||||||
|
"Don't feel bad; it's not for you this time."
|
||||||
]
|
]
|
||||||
|
|
||||||
# Choose a random color for each response
|
# Choose a random color for each response
|
||||||
response_colors = [Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.CYAN, Fore.MAGENTA, Fore.BLUE, Fore.WHITE]
|
response_colors = [Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.CYAN, Fore.MAGENTA, Fore.BLUE, Fore.WHITE]
|
||||||
|
|
||||||
|
# Colorize each letter
|
||||||
|
def colorize_text(text, colors):
|
||||||
|
colored_text = ""
|
||||||
|
for letter in text:
|
||||||
|
color = random.choice(colors)
|
||||||
|
colored_text += color + letter
|
||||||
|
return colored_text + Style.RESET_ALL
|
||||||
|
|
||||||
|
# Colorize each word
|
||||||
|
def colorize_word(text, colors):
|
||||||
|
words = text.split()
|
||||||
|
colored_word = ""
|
||||||
|
for word in words:
|
||||||
|
color = random.choice(colors)
|
||||||
|
colored_word += color + word + ' '
|
||||||
|
return colored_word + Style.RESET_ALL
|
||||||
|
|
||||||
# Display a random response with a random color
|
# Display a random response with a random color
|
||||||
response = random.choice(responses)
|
response = random.choice(responses)
|
||||||
response_color = random.choice(response_colors)
|
response_colored = colorize_text(response, response_colors)
|
||||||
print(f"The Pythonic Fate Ball says: {response_color}{response}{Style.RESET_ALL}")
|
|
||||||
|
# Color the narration
|
||||||
|
narration = "The Pythonic Fate Ball says: "
|
||||||
|
narration_colored = colorize_word(narration, response_colors)
|
||||||
|
print(f"{narration_colored}{response_colored}{Style.RESET_ALL}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
magic_fate_ball()
|
magic_fate_ball()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue