-
Notifications
You must be signed in to change notification settings - Fork 0
/
guriLeterGershere.py
175 lines (163 loc) · 4.93 KB
/
guriLeterGershere.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import random
import time
import turtle
window = turtle.Screen()
turtle.setup(800, 700)
window.bgcolor('light steel blue')
window.addshape('stone.gif')
window.addshape('paper.gif')
window.addshape('scissors.gif')
gure = turtle.Turtle()
gure.up()
gure.setposition(-230, 0)
gure.shape('stone.gif')
leter = turtle.Turtle()
leter.up()
leter.shape('paper.gif')
gershere = turtle.Turtle()
gershere.up()
gershere.setposition(230, 0)
gershere.shape('scissors.gif')
text2 = turtle.Turtle()
text2.up()
text2.ht()
text2.setposition(0, 250)
text = turtle.Turtle()
text.up()
text.ht()
text.setposition(0, -250)
luaj = turtle.Turtle()
luaj.up()
luaj.ht()
luaj.setposition(0, 300)
quit_t = turtle.Turtle()
quit_t.up()
quit_t.ht()
quit_t.setposition(0, -300)
style = ('Courier', 20, 'normal')
string = ""
string2 = ""
text.write(string, font=style, align='center')
loja = ["gure", "leter", "gershere"]
player = ""
computer = ""
player_turn = True
def clicked(x, y):
global loja
global player
global player_turn
global computer
global text
global text2
global style
global gure
global leter
global gershere
global luaj
global string2
global quit_t
copy1 = turtle.Turtle()
copy1.ht()
copy1.up()
copy2 = turtle.Turtle()
copy2.ht()
copy2.up()
def kompjuteri(computer, loja, copy2, string, text, string2, text2, luaj, quit_t):
time.sleep(2)
computer = random.choice(loja)
if (computer == "gure"):
copy2 = gure.clone()
copy2.setposition(230, 0)
elif (computer == "gershere"):
copy2 = gershere.clone()
copy2.setposition(230, 0)
elif (computer == "leter"):
copy2 = leter.clone()
copy2.setposition(230, 0)
copy2.st()
text.clear()
string = ("Kompjuteri zgjodhi " + computer)
text.write(string, font=style, align='center')
time.sleep(0.5)
if computer == player:
string2 = "Barazim"
text2.clear()
text2.write(string2, font=style, align='center')
if ((computer == "gershere" and player == "gure") or
(computer == "leter" and player == "gershere") or
(computer == "gure" and player == "leter")):
string2 = "Fitove"
text2.clear()
text2.write(string2, font=style, align='center')
elif ((computer == "gershere" and player == "leter") or
(computer == "gure" and player == "gershere") or
(computer == "leter" and player == "gure")):
string2 = "Humbe"
text2.clear()
text2.write(string2, font=style, align='center')
time.sleep(1)
luaj.write('Luaj perseri!', font=style, align='center')
quit_t.write('Perfundo!', font=style, align='center')
copy1.hideturtle()
copy2.hideturtle()
if player_turn == True:
gershere.st()
leter.st()
gure.st()
if (x > -100 and x < 104 and y > -168 and y < 175):
player = "leter"
text.clear()
string = ("Ju zgjodhet " + player)
text.write(string, font=style, align='center')
copy1 = leter.clone()
copy1.setposition(-230, 0)
gershere.ht()
leter.ht()
gure.ht()
copy1.showturtle()
kompjuteri(computer, loja, copy2, string, text, string2, text2, luaj, quit_t)
player_turn = False
elif (x > 141 and x < 319 and y > -168 and y < 175):
player = "gershere"
text.clear()
string = ("Ju zgjodhet " + player)
text.write(string, font=style, align='center')
copy1 = gershere.clone()
copy1.setposition(-230, 0)
gershere.ht()
leter.ht()
gure.ht()
copy1.showturtle()
kompjuteri(computer, loja, copy2, string, text, string2, text2, luaj, quit_t)
player_turn = False
elif (x > -332 and x < -127 and y > -168 and y < 143):
player = "gure"
text.clear()
string = ("Ju zgjodhet " + player)
text.write(string, font=style, align='center')
copy1 = gure.clone()
copy1.setposition(-230, 0)
gershere.ht()
leter.ht()
gure.ht()
copy1.showturtle()
kompjuteri(computer, loja, copy2, string, text, string2, text2, luaj, quit_t)
player_turn = False
else:
player = ""
else:
if (x > -60 and x < 60 and y > -300 and y < -270):
window.bye()
if (x > -104 and x < 101 and y < 334 and y > 300):
player_turn = True
player = ""
computer = ""
text2.clear()
luaj.clear()
quit_t.clear()
text.clear()
gure.st()
gershere.st()
leter.st()
turtle.onscreenclick(clicked)
window.mainloop()