Skip to content

Instantly share code, notes, and snippets.

@clamytoe
Created January 26, 2018 11:26
Show Gist options
  • Save clamytoe/eca88719a5f02b3dba91c2a7acba46dc to your computer and use it in GitHub Desktop.
Save clamytoe/eca88719a5f02b3dba91c2a7acba46dc to your computer and use it in GitHub Desktop.
hangman.py
from os import system, name
from time import sleep
from console import clear
# art from https://codereview.stackexchange.com/questions/101968/hangman-with-ascii
ascii_art = ("""
_________
|/
|
|
|
|
|
|___
""", """
_________
|/ |
|
|
|
|
|
|___
H""", """
_________
|/ |
| (_)
|
|
|
|
|___
HA""", """
________
|/ |
| (_)
| |
| |
|
|
|___
HAN""", """
_________
|/ |
| (_)
| /|
| |
|
|
|___
HANG""", """
_________
|/ |
| (_)
| /|\
| |
|
|
|___
HANGM""", """
________
|/ |
| (_)
| /|\
| |
| /
|
|___
HANGMA""", """
________
|/ |
| (_)
| /|\
| |
| / \
|
|___
HANGMAN""")
def clear_screen():
if name == 'nt':
_ = system('cls')
elif name == 'posix':
clear()
else:
_ = system('clear')
def main():
for art in ascii_art:
clear_screen()
print(art)
sleep(1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment