33import time
44
55
6- def reset (): # resets vars for new round
6+ # resets vars for new round
7+ def reset ():
78 global word , used , correct , fullWord , attempts , condition
89 word = ''
910 used = []
@@ -13,7 +14,8 @@ def reset(): # resets vars for new round
1314 condition = 0
1415
1516
16- def start (): # start function
17+ # start function
18+ def start ():
1719 global mode
1820 print ('---< commands >---' )
1921 print ('enter any letter as your guess' )
@@ -35,7 +37,7 @@ def again():
3537 option = input ('enter !save to save your results\n enter !play to play again\n enter !stop to stop\n ' )
3638 if option == '!stop' :
3739 exit ()
38- elif option == '!save' : # needs auto save (function maybe)
40+ elif option == '!save' :
3941 file = open ('history' , 'a' )
4042 file .write ('\n =-=-=-=-=-=-=-=-=-=-=-=-=-=\n ' )
4143 file .write (f'{ endCondition } \n ' )
@@ -54,7 +56,8 @@ def again():
5456 exit ()
5557
5658
57- def stats (): # stats for end of game
59+ # stats for end of game
60+ def stats ():
5861 global mode , attempts , lives , endCondition
5962 if attempts < 0 :
6063 attempts = 0
@@ -64,7 +67,8 @@ def stats(): # stats for end of game
6467 else :
6568 attempts = 12
6669 print ('=-=-=-=-=-=-=-=-=-=-=-=-=-=' )
67- if condition == 0 : # sets end condition of the game
70+ # sets end condition of the game
71+ if condition == 0 :
6872 endCondition = 'you won'
6973 elif condition == 1 :
7074 endCondition = 'you lost | you ran out of lives'
@@ -95,12 +99,14 @@ def main():
9599 else :
96100 print ('you are on normal mode' )
97101 wordlength = len (word )
98- while wordlength != 0 : # creates the word visual
102+ # creates the word visual
103+ while wordlength != 0 :
99104 fullWord .append ('_' )
100105 wordlength -= 1
101- fullWord .pop () # fix's weird glitch with word visual
106+ fullWord .pop ()
102107 print (fullWord )
103- print (f'word length: { len (word ) - 1 } ' ) # idk whats wrong with this, but it needs to be like this
108+ # takes enter key value from words file needs it removed
109+ print (f'word length: { len (word ) - 1 } ' )
104110 print (f'lives: { attempts } ' )
105111
106112 while attempts > 0 :
@@ -119,20 +125,24 @@ def main():
119125 stats ()
120126 else :
121127 print ('skipped' )
122- elif option == '!guess' : # option to guess the full word
128+ # option to guess the full word
129+ elif option == '!guess' :
123130 if mode == '!hard' :
124131 print ('if incorrect you will lose' )
125132 else :
126133 print ('if incorrect you will lose 2 lives' )
127134 print ('enter y to give up\n enter any key to skip' )
128135 option = input ('enter your choice: ' )
129- word = word [:- 1 ] # something wrong with word, idk anymore
130- if option == 'y' : # makes sure that you actually want to do it
136+ word = word [:- 1 ]
137+ # confirm option
138+ if option == 'y' :
131139 option = input ('enter word: ' )
132- if option == word : # checks if the word is right
140+ # checks if the word is right after guessing full word
141+ if option == word :
133142 condition = 0
134143 stats ()
135- elif option != word and mode != '!hard' : # checks if you are on normal mode
144+ # checks if you are on normal mode
145+ elif option != word and mode != '!hard' :
136146 print ('that\' s not the right word | -2 attempts' )
137147 attempts -= 2
138148 print (f'lives: { attempts } ' )
@@ -145,35 +155,41 @@ def main():
145155 else :
146156 print ('skipped' )
147157 else :
148- if len (option ) > 1 : # checks that you only entered 1 letter
158+ # checks that you only entered 1 letter
159+ if len (option ) > 1 :
149160 print ('enter !guess to guess the full word' )
150161 else :
151162 letterUsed = False # I don't fucking know, it does something I think
152163 num = 0
153- for _ in used : # checks if letter has been used before
164+ # checks if letter has been used before
165+ for _ in used :
154166 if option == used [num ]:
155167 print (f'letter { option } has already been used' )
156168 print ('enter !used to see all used letters' )
157169 letterUsed = True
158170 num += 1
159171
160172 num = 0
161- for _ in word : # adds letter to its spot in hidden word
173+ # adds letter to its spot in hidden word
174+ for _ in word :
162175 if letterUsed is True :
163176 pass
164- elif option == word [num ]: # weird word symbol thing
177+ # setup for blank spots
178+ elif option == word [num ]:
165179 temp = list (fullWord )
166180 temp [num ] = option
167181 fullWord = '' .join (temp )
168182 correct += 1
169183 num += 1
170184
171- if option not in word and option not in used : # checks if it should take away a life
185+ # checks if it should take away a life
186+ if option not in word and option not in used :
172187 attempts -= 1
173188
174189 print (fullWord )
175190
176- if letterUsed is True : # adds letter to used list
191+ # adds letter to used list
192+ if letterUsed is True :
177193 pass
178194 else : # adds every letter to list
179195 used .append (option )
@@ -192,5 +208,3 @@ def main():
192208print ('---< made by: cqb13 >---\n ' )
193209time .sleep (1 )
194210start ()
195-
196- # make auto save that works
0 commit comments