-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathahorcado.py
177 lines (142 loc) · 3.72 KB
/
ahorcado.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
print(" _______")
print("| |")
print("|")
print("|")
print("|")
print("|")
print("⟘")
print("\n")
import random
import os
palabras = ["casa","caballo","cigarrillo","celular","mesa","computadora","casco","botella",
"multiplo","control","distrofia","artritis","cuadriplejia","ligamento","orina","pantorrilla",
"trasladar","vejiga","velcro","television","escenario","alcahuete","ebullicion","hostigar",
"descenso","embarcar","escabullirse","fehaciente","golpiza","habitaculo","halagar","hazmerreir",
"hectarea","hechicero","hemorragia","herbivoro","heroismo","hojalata","homicida","honestidad",
"ahorcado","hornero","hospedaje","huracan","impaciencia","incineracion","incorruptible",]
guess_word = []
duration = 0.5
freq = 800
key_word = random.choice(palabras)
length_word = len(key_word)
alphabet = "abcdefghijklmnopqrstuvwxyz"
letter_storage = []
def print_word_to_guess(letters):
print("⹅"*length_word*3)
print(" ".join(letters))
print("⹅"*length_word*3)
def change():
for character in key_word:
guess_word.append("_ ")
print("Well, the word You need to guess has", length_word, "characters")
print("Be aware that You can enter only 1 letter form a-z")
print_word_to_guess(guess_word)
def guessing():
turn=7
while turn > 0 :
guess = input("Choose a Letter: ").lower()
if not guess in alphabet:
print("\n")
print("⹅"*34)
print("Enter just one letter from a-z alphabet")
print("⹅"*34)
print("\n")
elif guess in letter_storage:
print("\n")
print("⹅"*34)
print("You already guessed that letter!!")
print("⹅"*34)
print("\n")
else:
letter_storage.append(guess)
if guess in key_word:
print("\n")
print("You guessed correctly!")
for x in range(0,length_word):
if key_word[x] == guess:
guess_word[x] = guess
print("\n")
print_word_to_guess(guess_word)
if not "_ " in guess_word:
print("\n")
print("You Won!!")
print("\n")
print("Game Over")
break
else:
print("\n")
print("The letter is not in the word. Try Again!")
turn = turn - 1
if turn == 6:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("|")
print("|")
print("|")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 5:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| | ")
print("|")
print("|")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 4:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| /|")
print("|")
print("|")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 3:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| /|\ ")
print("|")
print("|")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 2:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| /|\ ")
print("| |")
print("|")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 1:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| /|\ ")
print("| |")
print("| /")
print("⟘")
print_word_to_guess(guess_word)
elif turn == 0:
print("\n")
print(" _______")
print("| |")
print("| ☹")
print("| /|\ ")
print("| |")
print("| / \ ")
print("⟘")
print("\n")
print(" Sorry Mate, You lost :<! The secret word was",key_word)
change()
guessing()