1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-11-11 12:32:37 +01:00
discordbot/hangman.py
2020-10-10 11:32:53 +02:00

101 lines
No EOL
1.3 KiB
Python

#!/usr/bin/env python3
hangman = ['''
''','''
=========''','''
|
|
|
|
|
=========''','''
+---
|
|
|
|
|
=========''','''
+---+
|
|
|
|
|
=========''','''
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========''', '''
+---+
| |
O |
/| |
|
|
=========''', '''
+---+
| |
O |
/|\ |
|
|
=========''', '''
+---+
| |
O |
/|\ |
/ |
|
=========''', '''
+---+
| |
O |
/|\ |
/ \ |
|
=========''']
def generateHangmanMessage(word, right, wrong):
word = list(word)
right = right.split(";")
wrong = wrong.split(";")
message = "```\n" + hangman[len(wrong) if (wrong != ['']) else 0]
message = message + "```\n\n`"
for letter in word:
if(letter in right):
message = message + letter + " "
elif not letter in "abcdefghijklmnopqrstuvwxyz":
message = message + letter + " "
else:
message = message + "_ "
return message[:-1] + "`"