Skip to content

Instantly share code, notes, and snippets.

@mugan86
Created May 22, 2021 09:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mugan86/afea09a79080c56e73d8ec7771e6ed87 to your computer and use it in GitHub Desktop.
Save mugan86/afea09a79080c56e73d8ec7771e6ed87 to your computer and use it in GitHub Desktop.
Ahorcado - Strangle classes to create game in Python
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'
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