And then I colorized it.

This commit is contained in:
CSnap 2023-11-17 00:54:35 +00:00
parent 6fe35a5047
commit eabdb77797
3 changed files with 14 additions and 4 deletions

View File

@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
PyF8-Ball Pythonic Fate Ball
Copyright (C) 2023 CSnap Copyright (C) 2023 CSnap
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

View File

@ -3,5 +3,8 @@
Let python decide your fate via 8-Ball logic! Let python decide your fate via 8-Ball logic!
Call the script with a question. Get an answer. Call the script with a question. Get an answer.
```
./f8ball.py "Question?"
```
Results may vary. No warranty or guarantee of any kind is implied. *Results may vary. No warranty or guarantee of any kind is implied.*

View File

@ -1,8 +1,11 @@
#!/usr/bin/python #!/usr/bin/python
from colorama import Fore, Style, init
import random import random
import sys import sys
init(autoreset=True)
def magic_fate_ball(): def magic_fate_ball():
# Define possible responses # Define possible responses
responses = [ responses = [
@ -23,9 +26,13 @@ def magic_fate_ball():
"This is The Way." "This is The Way."
] ]
# Display a random response # Choose a random color for each response
response_colors = [Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.CYAN, Fore.MAGENTA, Fore.BLUE, Fore.WHITE]
# Display a random response with a random color
response = random.choice(responses) response = random.choice(responses)
print(f"The Pythonic Fate Ball says: {response}") response_color = random.choice(response_colors)
print(f"The Pythonic Fate Ball says: {response_color}{response}{Style.RESET_ALL}")
if __name__ == "__main__": if __name__ == "__main__":
magic_fate_ball() magic_fate_ball()