Files
lab3/task1.py
2026-03-18 11:25:26 +03:00

36 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pygame
from pygame.draw import *
pygame.init()
screen = pygame.display.set_mode((800, 600))
# Какой-то запутанный код с зайцем
# (пример плохого кода, который нужно отрефакторить)
# Левое ухо
ellipse(screen, (150, 150, 150), (350, 130, 30, 100))
# Правое ухо
ellipse(screen, (150, 150, 150), (420, 130, 30, 100))
# Голова
circle(screen, (150, 150, 150), (400, 250), 40)
# Глаза
circle(screen, (0, 0, 0), (385, 240), 5)
circle(screen, (0, 0, 0), (415, 240), 5)
# Нос
circle(screen, (255, 0, 0), (400, 260), 5)
# Тело
ellipse(screen, (150, 150, 150), (360, 280, 80, 120))
ellipse(screen, (150, 150, 150), (355, 290, 25, 45))
ellipse(screen, (150, 150, 150), (420, 290, 25, 45))
# Лапы
ellipse(screen, (150, 150, 150), (340, 360, 30, 50))
ellipse(screen, (150, 150, 150), (430, 360, 30, 50))
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()