-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
74 lines (68 loc) · 1.88 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import os
import DeathHuman
import Service
maxCount = len(DeathHuman.images)
tryCount = 0
findWorld = ''
empty = ''
def num(s):
try:
int(s)
return num(input('Bir kelime girin : '))
except ValueError:
return s.lower()
#listede ki _ yerini değiştirip kelimeleri ekleme
def changeIndex(index,string,new):
listString = list(string)
listString[index*2]= new
return ''.join(listString)
def endGame():
try:
end = int(input('Devam mı ? (evet 1 hayır 0) : '))
if end == 1:
return False
else:
print('Oyun biter.')
return True
except ValueError:
print('Oyun biter.')
return True
def newGame():
os.system('cls' if os.name == 'nt' else 'clear')
#mac os X or Windows
findWorld = Service.get('worldlist')
print('Hello Welcome Man Hang :) \n')
empty= ''
# gelen kelimeyi saklıyoruz
for letter in findWorld:
empty += "_ "
print(empty)
tryCount = 0
while True :
# klavyeden sayı girmeyi engelleme
numberCheck = True
world = num(input('Bir kelime girin : '))
# kelime kontrol varmı yokmu
result = findWorld.find(world)
if result != -1:
for number in range(0,len(findWorld)):
if findWorld[number] == world:
# empty.index = world+' '
empty = changeIndex(number,empty,world)
else :
continue
else :
print(DeathHuman.images[tryCount])
tryCount += 1
print(empty)
if tryCount+1 == maxCount :
if endGame():
exit()
else:
newGame()
if empty.find('_') == -1 :
if endGame():
exit()
else:
newGame()
newGame()