-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpizzafinal.py
197 lines (156 loc) · 3.72 KB
/
pizzafinal.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import random
from turtle import *
speed(0)
screen=Screen()
screen.setup(width=500, height=500)
def pizza_shape(pshape):
if pshape == "circle":
penup()
right(90)
forward(200)
right(270)
pendown()
begin_fill()
fillcolor("tan")
circle(200)
penup()
home()
end_fill()
def inner_circle(fill_color):
penup()
right(90)
forward(170)
right(270)
pendown()
begin_fill()
fillcolor(fill_color)
circle(170)
penup()
home()
end_fill()
def pizza_sauce(psauce):
if psauce == "marinara":
inner_circle("red")
elif psauce == "white sauce":
inner_circle("white")
else:
psauce == "bbq sauce"
inner_circle("brown")
def pizza_cheese(pcheese):
if pcheese == "mozzerella":
inner_circle("yellow")
else:
pcheese == "cheddar"
inner_circle("orange")
def pizza_toppings(ptoppings):
for item in ptoppings:
if item == "pepperoni":
dpepperoni()
elif item == "sausage":
dsausage()
elif item == "green pepper":
dgreenpepper()
elif item == "pineapple":
dpineapple()
elif item == "ham":
dham()
item = item
def dpepperoni():
for x in range(5):
penup()
goto(random_coordinates())
begin_fill()
fillcolor("red")
for i in range(1):
circle(40)
end_fill()
def dsausage():
for x in range(5):
penup()
goto(random_coordinates())
begin_fill()
fillcolor("brown")
for i in range(1):
circle(30)
end_fill()
def dgreenpepper():
for x in range(5):
penup()
goto(random_coordinates())
begin_fill()
fillcolor("green")
for i in range(1):
forward(30)
right(90)
forward(15)
right(90)
forward(30)
right(90)
forward(15)
right(90)
end_fill()
def dpineapple():
for x in range(5):
penup()
goto(random_coordinates())
begin_fill()
fillcolor("yellow")
for i in range(3):
forward(30)
left(120)
end_fill()
def dham():
for x in range(5):
penup()
goto(random_coordinates())
begin_fill()
fillcolor("pink")
for i in range(3):
forward(30)
left(120)
end_fill()
# Function to generate random x, y coordinates
def random_coordinates():
x = random.randint(-110, 110) # Adjust the range based on your needs
y = random.randint(-110, 110)
return x, y
def pizza_list(pshape, psauce, pcheese, ptoppings):
pizza_shape(pshape)
pizza_sauce(psauce)
pizza_cheese(pcheese)
pizza_toppings(ptoppings)
shape = {
'circle': "cicrle"
}
sauce = {
'marinara': "red",
'white sauce': "white",
'bbq sauce': 'brown'
}
cheese = {
'mozzerella': "yellow",
'cheddar': "orange"
}
toppings = {
'pepperoni': "pepperoni",
'sausage': "sausage",
'green pepper': "green pepper",
'pineapple': "pineapple",
'ham': "ham"
}
for key in sauce.keys():
psauce = random.choice(list(sauce))
for key in shape.keys():
pshape = random.choice(list(shape))
for key in cheese.keys():
pcheese = random.choice(list(cheese))
for key in toppings.keys():
toppingslist = (list(toppings))
toppingsnumber = random.randrange(1,5)
ptoppings = (random.sample(toppingslist,toppingsnumber))
pizza_list(pshape, psauce, pcheese, ptoppings)
print(psauce)
print(pcheese)
print(ptoppings)
hideturtle()
done()