# Примерен код от урока: фигурки, които падат и отскачат (Turtle Graphics)
import turtle
import random

window = turtle.Screen()
window.bgcolor("black")
window.tracer(0)

figures = []
for _ in range(25):
    figures.append(turtle.Turtle())

colors = ['red', 'green', 'blue', 'orange', 'yellow', 'white', 'purple']
shapes = ['square', 'circle', 'triangle']

for figure in figures:
    figure.shape(random.choice(shapes))
    figure.color(random.choice(colors))
    figure.penup()
    figure.speed(0)
    x = random.randint(-200, 200)
    y = random.randint(200, 300)
    figure.goto(x, y)
    figure.dy = 0
    figure.dx = random.randint(-3, 3)
    figure.da = random.randint(-5, 5)

gravity = 0.1

while True:
    window.update()
    for figure in figures:
        figure.rt(figure.da)
        figure.dy -= gravity
        figure.sety(figure.ycor() + figure.dy)
        figure.setx(figure.xcor() + figure.dx)
        if figure.xcor() > 200:
            figure.dx *= -1
            figure.da *= -1
        if figure.xcor() < -200:
            figure.dx *= -1
            figure.da *= -1
        if figure.ycor() < -200:
            figure.sety(-200)
            figure.dy *= -1
