Created
May 22, 2021 09:51
-
-
Save mugan86/afea09a79080c56e73d8ec7771e6ed87 to your computer and use it in GitHub Desktop.
Ahorcado - Strangle classes to create game in Python
This file contains hidden or 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
COLORS = { | |
'HEADER' : '\033[95m', | |
'OKBLUE' : '\033[94m', | |
'OKCYAN' : '\033[96m', | |
'OKGREEN' : '\033[92m', | |
'WARNING' : '\033[93m', | |
'FAIL' : '\033[91m', | |
'ENDC' : '\033[0m', # Para limpiar el color y resetear | |
'BOLD' : '\033[1m', | |
'UNDERLINE' : '\033[4m' |
This file contains hidden or 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
from colors import COLORS | |
class Draw: | |
def image(self, attemps, hide_word): | |
print("====================") | |
print(f"Intentos: {attemps}") | |
print("====================") | |
if(attemps == 6): | |
print(" ---------------------") | |
for _ in range(16): | |
print(" |") | |
print("__________") | |
elif(attemps == 5): | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | - - |") | |
print(" | | o |") | |
print(" | -------") | |
for _ in range(11): | |
print(" |") | |
print("__________") | |
elif(attemps == 4): | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | - - |") | |
print(" | | o |") | |
print(" | -------") | |
print(" | | ") | |
print(" | | ") | |
print(" | | ") | |
print(" | | ") | |
print(" | | ") | |
for _ in range(6): | |
print(" |") | |
print("__________") | |
elif(attemps == 3): | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | - - |") | |
print(" | | o |") | |
print(" | -------") | |
print(" | | ") | |
print(" | / | ") | |
print(" | / | ") | |
print(" | / | ") | |
print(" | | ") | |
for _ in range(6): | |
print(" |") | |
print("__________") | |
elif(attemps == 2): | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | - - |") | |
print(" | | o |") | |
print(" | -------") | |
print(" | | ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | | ") | |
for _ in range(6): | |
print(" |") | |
print("__________") | |
elif(attemps == 1): | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | - - |") | |
print(" | | o |") | |
print(" | -------") | |
print(" | | ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | | ") | |
print(" | / ") | |
print(" | / ") | |
print(" | / ") | |
for _ in range(3): | |
print(" |") | |
print("__________") | |
elif(attemps == 0): | |
print( | |
f"{COLORS['FAIL']}GAME OVER - La palabra oculta es \"{hide_word}\"{COLORS['ENDC']}") | |
print(" ---------------------") | |
print(" | |") | |
print(" | |") | |
print(" | -------") | |
print(" | | X X |") | |
print(" | | o |") | |
print(" | -------") | |
print(" | | ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | / | \\ ") | |
print(" | | ") | |
print(" | / \\") | |
print(" | / \\ ") | |
print(" | / \\ ") | |
for _ in range(3): | |
print(" |") | |
print("__________") | |
def hide_word(hideword): | |
print("Palabra a buscar: ") | |
print(hideword) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment