-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstone.py
153 lines (140 loc) · 6.12 KB
/
stone.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
import threading
from tkinter import*
import random
root = Tk()
root.config(bg="#6c6c6c")
root.title('GAME~1, more to go')
root.geometry("534x456")
comp_choice=['stone','paper','scissor']
computer_score = 0
player_score = 0
wid_of_tie_screen = 30
def time_collapse():
root.destroy()
def press():
global computer_score
global player_score
play_computer=random.choice(comp_choice)
#print(play_computer)
if play_computer == (comp_choice[0]):
l6=Label(root,text="Player beats computer this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("player wins")
l2=Label(root,text="stone",width=10,font="helvetica 13 ")
l2.place(x=315,y=340)
player_score += 1
if player_score >= 10:
print("THE WINNER OF THE GAME IS OUR PLAYER")
show_time = threading.Timer(3,time_collapse)
show_time.start()
l5.config(text="Player score:" + str(player_score))
elif play_computer == comp_choice[1] :
print("tie")
l6=Label(root,text="round got tied...!",fg="red",font="lucid 12 italic",justify=CENTER,width=wid_of_tie_screen)
l6.place(x=135,y=230)
l2=Label(root,text="paper",width=10,font="helvetica 13")
l2.place(x=315,y=340)
elif play_computer == comp_choice[2] :
l6=Label(root,text="Computer beats player this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("computer wins")
computer_score += 1
if computer_score >= 10:
print("COMPUTER WINS, WOULD NOW AI OVERPOWER THE HUMAN BRAIN !")
show_time = threading.Timer(3,time_collapse)
show_time.start()
print(computer_score)
l4.config(text="Computer score:" + str(computer_score))
l2=Label(root,text="scissor",width=10,font="helvetica 13 ")
l2.place(x=315,y=340)
def press1():
global computer_score
global player_score
play_computer=random.choice(comp_choice)
#print(play_computer)
if play_computer == (comp_choice[0]):
print("tie")
l6=Label(root,text="round got tied...!",fg="red",font="lucid 12 italic",width=wid_of_tie_screen,justify=CENTER)
l6.place(x=135,y=230)
l2=Label(root,text="stone",width=10,font="helvetica 13 ")
l2.place(x=315,y=340)
elif play_computer == comp_choice[1] :
l6=Label(root,text="Computer beats player this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("computer wins")
computer_score += 1
if computer_score >= 10:
print("COMPUTER WINS, WOULD NOW AI OVERPOWER THE HUMAN BRAIN !")
show_time = threading.Timer(3,time_collapse)
show_time.start()
print(computer_score)
l4.configure(text="Computer score:" + str(computer_score))
l2=Label(root,text="paper",width=10,font="helvetica 13")
l2.place(x=315,y=340)
elif play_computer == comp_choice[2] :
l6=Label(root,text="Player beats computer this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("player wins")
l2=Label(root,text="scissor",width=10,font="helvetica 13 ")
l2.place(x=315,y=340)
player_score += 1
if player_score >= 10:
print("THE WINNER OF THE GAME IS OUR PLAYER")
show_time = threading.Timer(3,time_collapse)
show_time.start()
l5.configure(text="Player score:" + str(player_score))
def press2():
global computer_score
global player_score
play_computer=random.choice(comp_choice)
#print(play_computer)
if play_computer == (comp_choice[0]):
l6=Label(root,text=" Computer beats player this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("computer wins")
computer_score += 1
if computer_score >= 10:
print("COMPUTER WINS, WOULD NOW AI OVERPOWER THE HUMAN BRAIN !")
show_time = threading.Timer(3,time_collapse)
show_time.start()
print(computer_score)
l4.config(text="Computer score:" + str(computer_score))
l2=Label(root,text="stone",width=10,font="helvetica 13 ")
l2.place(x=315,y=340)
elif play_computer == comp_choice[1] :
l6=Label(root,text="Player beats computer this round...!",fg="red",font="lucid 12 italic")
l6.place(x=135,y=230)
print("player wins")
l2=Label(root,text="paper",width=10,font="helvetica 13")
l2.place(x=315,y=340)
player_score += 1
if player_score >= 10:
print("THE WINNER OF THE GAME IS OUR PLAYER")
show_time = threading.Timer(3,time_collapse)
show_time.start()
l5.config(text="Player score:" + str(player_score))
elif play_computer == comp_choice[2] :
print("tie")
l6=Label(root,text="round got tied...!",fg="red",font="lucid 12 italic",width=wid_of_tie_screen,justify=CENTER)
l6.place(x=135,y=230)
l2=Label(root,text="scissor",width=10,font="helvetica 13 ")
l2.place(x=310,y=340)
f1 = Frame(root,bg="#303030")
f1.pack(side=TOP,fill=X)
l1= Label(f1,text=" STONE PAPER SCISSORS ",font="helvetica 28 bold ",bg="#000000",fg="#e8ceb6",justify=CENTER,relief=FLAT)
l1.pack(side=TOP,padx=23,pady=36)
l3=Label(root,text="COMP. CHOICE IS:",width=20,font="helvetica 13 bold")
l3.place(x=130,y=340)
b1=Button(root,text="PAPER",font="comicsans 16 bold",fg="powder blue",command=press,relief=FLAT)
b1.place(x=220,y=140)
b2=Button(root,text=" STONE ",font="comicsans 16 bold",fg="powder blue",command=press1,relief=FLAT)
b2.place(x=75,y=140)
b3=Button(root,text="SCISSOR",font="comicsans 16 bold",fg="powder blue",command=press2,relief=FLAT)
b3.place(x=350,y=140)
l4 = Label(root,text="Computer score:",font="helvetica 12 italic",bg="#e8ceb6",justify=CENTER)
l4.place(x=500,y=400,anchor="se")
l5 = Label(root,text="Player score:",font="helvetica 12 italic",bg="#e8ceb6",justify=CENTER)
l5.place(x=140,y=400,anchor="se")
root.mainloop()
print("Computer final score was: ",computer_score)
print("Player's final score was: ",player_score)