# -*- coding: utf-8 -*
#/usr/bin/python
import asciiarts
import time
import os
from random import randint
os.system('color F0')
clear = lambda: os.system('cls')
a = 1
b = 0
c = 1
d = 0
e = 0
i = 1
m = 0
p = 1
q = 0
lifes = 0
lifesmax = 0
victime = 0
wordaray = []
letterpositions = []
wrongletters = []
with open("Text.txt") as text:
text1 = text.readlines()
text2 = text1[0]
text3 = text2.replace('.', '')
text4 = text3.replace(',', '')
text5 = text4.replace('\x96', '')
text6 = text5.replace('(', '')
text7 = text6.replace(')', '')
text8 = text7.replace('"', '')
text9 = text8.replace('!', '')
text10 = text9.replace('?', '')
text11 = text10.replace('„', '')
text12 = text11.replace('[', '')
text13 = text12.replace(']', '')
text14 = text13.replace('1', '')
text15 = text14.replace('\xe4', 'ae')
text16 = text15.replace('\xfc', 'ue')
text17 = text16.replace('\xf6', 'oe')
text18 = text17.replace('\x84', '')
text19 = text18.replace('\x93', '')
text20 = text19.lower()
text1 = 0
text2 = 0
text3 = 0
text4 = 0
text5 = 0
text6 = 0
text7 = 0
text8 = 0
text9 = 0
text10 = 0
text11 = 0
text12 = 0
text13 = 0
text14 = 0
text15 = 0
text16 = 0
text17 = 0
text18 = 0
text19 = 0
words = text20.split()
#print words
count = (len(words)-1)
#print "Count: %s" % (count)
#print "\n"
wordnumber = randint(0, count)
#print "Wordnumber: %s" % (wordnumber)
#print "\n"
word = words[wordnumber]
#print "Word: %s" % (word)
#print "\n"
spellword = list(word)
viccomp = list(word)
#print spellword
letters = len(spellword)
#print letters
while i <= letters:
wordaray.append ("_")
i = i+1
print wordaray
while a == 1:
lifes = int(input("\nLifes = "))
lifesmax = lifes
print lifes
b = raw_input("\nok?\nYes[y] No[n]\n")
if b == 'y':
break
elif b == 'n':
print "Restart"
else:
print "ERROR"
clear()
print "\n"
print "Wrong letters: %s" %(wrongletters)
print wordaray
#print letters*"_ "
while c == 1:
lifespic = ((lifes - 0) * (9 - 0) / (lifesmax - 0) + 0)
if lifespic == 8:
asciiarts.lifespic8()
if lifespic == 7:
asciiarts.lifespic7()
if lifespic == 6:
asciiarts.lifespic6()
if lifespic == 5:
asciiarts.lifespic5()
if lifespic == 4:
asciiarts.lifespic4()
if lifespic == 3:
asciiarts.lifespic3()
if lifespic == 2:
asciiarts.lifespic2()
if lifespic == 1:
asciiarts.lifespic1()
if lifespic == 0:
asciiarts.lifespic0()
time.sleep(2)
clear()
os.system('color 04')
print "The correct word was: %s" % (viccomp)
asciiarts.gameover()
e = 1
while e == 1:
os.system('color 04')
time.sleep(.2)
os.system('color 0C')
time.sleep(.2)
letter = raw_input("Type your letter: ")
d = letter in spellword
#print d
if d == True:
clear()
print "In Word"
print "Remaining Lifes: %s" %(lifes)
letterposition = (spellword.index(letter)+1)
#print letterposition
wordaray [letterposition-1] = letter
#print wordaray
spellword [letterposition-1] = "."
d = letter in spellword
if d == True:
letterposition = (spellword.index(letter)+1)
#print letterposition
wordaray [letterposition-1] = letter
#print wordaray
spellword [letterposition-1] = "-"
d = letter in spellword
print wordaray
print "Wrong letters: %s" %(wrongletters)
else:
clear()
print "Not in word"
lifes = lifes-1
print "Remaining lifes: %s" % (lifes)
print wordaray
wrongletters.append(letter)
print "Wrong letters: %s" %(wrongletters)
vic = viccomp == wordaray
if vic == True:
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
victime = 1
while victime == 1:
rcolor = randint(0, 9)
#print rcolor
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ /|\ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 0C')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ \|/ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 01')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ /|\ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 02')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ \|/ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 03')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ /|\ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 04')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ \|/ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 05')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ /|\ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 06')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ \|/ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 07')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ /|\ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 08')
time.sleep(.2)
clear()
print wordaray
print "You got the Word. CONGRATULATIONS!"
print " _____ "
print " |/ | "
print " | "
print " | "
print " | "
print " | (^.^)"
print " ____|____ \|/ "
print " / \ | "
print "__/ \__ / \ "
os.system('color 09')