Skip to content

Instantly share code, notes, and snippets.

@Yoiter
Last active December 8, 2017 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yoiter/159ba96badbccb2e2957624c03d046f6 to your computer and use it in GitHub Desktop.
Save Yoiter/159ba96badbccb2e2957624c03d046f6 to your computer and use it in GitHub Desktop.
def drawing(tries):
if tries == 6:
print(" _______")
print("| |")
print("|")
print("|")
print("|")
print("|")
print("|")
elif tries == 5:
print(" _______")
print("| |")
print("| 0")
print("|")
print("|")
print("|")
print("|")
elif tries == 4:
print(" _______")
print("| |")
print("| 0")
print("| |")
print("|")
print("|")
print("|")
elif tries == 3:
print(" _______")
print("| |")
print("| 0")
print("| |\ ")
print("|")
print("|")
print("|")
elif tries == 2:
print(" _______")
print("| |")
print("| 0")
print("| /|\ ")
print("|")
print("|")
print("|")
elif tries == 1:
print(" _______")
print("| |")
print("| 0")
print("| /|\ ")
print("| |")
print("|")
print("|")
elif tries == 0:
print(" _______")
print("| |")
print("| 0")
print("| /|\ ")
print("| |")
print("| / \ ")
print("|")
def hint():
hintrqst = "Please send hint"
s.send(hintrqst)
while True:
print((str(s.recv(1024)).decode('UTF-8')))
print("▒█░▒█ ░█▀▀█ ▒█▄░▒█ ▒█▀▀█ ▒█▀▄▀█ ░█▀▀█ ▒█▄░▒█ ")
print("▒█▀▀█ ▒█▄▄█ ▒█▒█▒█ ▒█░▄▄ ▒█▒█▒█ ▒█▄▄█ ▒█▒█▒█ ")
print("▒█░▒█ ▒█░▒█ ▒█░░▀█ ▒█▄▄█ ▒█░░▒█ ▒█░▒█ ▒█░░▀█")
print("by Ubisoft")
print("웃 - don't let me die!")
import socket
s = socket.socket()
host='127.0.0.1'
port=50004
s.connect((host, port))
word = None
while True:
word = "yeet"
progress = ["_"] * len(word)
print("You have 7 tries, good luck")
tries = 7
print("type '>:(' to quit")
print("After getting a guess wrong, you can request a hint by typing 'hint'")
guess = input("Guess a letter: ")
while guess != ">:(":
for i in range(len(word)):
if guess == word[i]:
progress[i] = guess
correct = str("guessed right, player guessed:" + guess)
s.send(guess.encode('UTF-8'))
if guess not in word:
tries = tries - 1
fail = str("guessed wrong, player guessed:" + guess)
s.send(fail.encode('UTF-8'))
if guess == "hint":
hint()
final = " ".join(progress)
ezfinal = "".join(progress)
drawing(tries)
if ezfinal == word:
print(final)
print("Good Job! You got it!")
victory = "The player won!"
s.send(victory.encode('UTF-8'))
break
elif tries == 0:
print("You ran out of tries, better luck next time!")
print("The word was: " + word)
print("█░░ █▀▀█ █▀▀ █▀▀ █▀▀█ ")
print("█░░ █░░█ ▀▀█ █▀▀ █▄▄▀ ")
print("▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ ▀░▀▀ ")
loss = "The player lost!"
s.send(loss.encode('UTF-8'))
break
print(final)
print("You have " + str(tries) + " tries left")
clienttries = str("Client has:" + str(tries) + "tries")
s.send = (clienttries.encode('UTF-8'))
guess = input("Guess a letter: ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment