Fix end
This commit is contained in:
parent
2b7ba61912
commit
873a3301ca
@ -64,9 +64,13 @@ def best_letter(word_resolve):
|
||||
sorted_letters = sorted(
|
||||
letters.items(), key=operator.itemgetter(1), reverse=True
|
||||
)
|
||||
|
||||
# Best letter
|
||||
if len(sorted_letters) > 0:
|
||||
return sorted_letters[0][0]
|
||||
else:
|
||||
end = True
|
||||
print('No more possibilities')
|
||||
return None
|
||||
|
||||
# End Functions
|
||||
|
||||
@ -98,6 +102,7 @@ print('')
|
||||
while play:
|
||||
# Get best letter
|
||||
best_option = best_letter(word_resolve)
|
||||
if best_option:
|
||||
# The guard not to give it back
|
||||
letters_used.append(best_option)
|
||||
print_words()
|
||||
@ -122,10 +127,9 @@ while play:
|
||||
word_resolve[int(pos) - 1] = best_option
|
||||
|
||||
# Game over
|
||||
end = True
|
||||
for letter in word_resolve:
|
||||
if letter != '_':
|
||||
end = False
|
||||
if not '_' in word_resolve:
|
||||
end = True
|
||||
if end:
|
||||
play = False
|
||||
print('Game over :)')
|
Loading…
Reference in New Issue
Block a user