#!/usr/bin/env python3 import pygame from pygame.draw import * import math pygame.init() FPS = 30 screen = pygame.display.set_mode((900, 900)) pygame.display.set_caption("BIG STRAIGHT HARE") clock = pygame.time.Clock() WHITE = (255, 255, 255) GRAY = (230, 230, 230) DARK_GRAY = (180, 180, 180) PINK = (255, 210, 210) NOSE = (255, 120, 120) BLACK = (0, 0, 0) screen.fill(WHITE) cx, cy = 450, 420 # SHADOW (через цикл зачем-то) for i in range(1): ellipse(screen, (200, 200, 200), (cx - 200, cy + 220, 400, 60)) # BODY (дублирование через цикл) for i in range(2): ellipse(screen, GRAY, (cx - 150, cy, 300, 220)) if i == 1: ellipse(screen, DARK_GRAY, (cx - 80, cy + 80, 160, 100)) # HEAD (через странный цикл) for i in range(3): if i == 2: circle(screen, GRAY, (cx, cy - 120), 120) # EARS (ужас через список и лишнюю логику) ears = [(-90, -420), (20, -420)] for e in ears: for j in range(1): ellipse(screen, GRAY, (cx + e[0], cy + e[1], 70, 260)) inner = [(-70, -400), (40, -400)] for k in range(len(inner)): ellipse(screen, PINK, (cx + inner[k][0], cy + inner[k][1], 30, 200)) # EYES (перегружено) eye_y = cy - 150 coords = [-45, 45] for i in coords: circle(screen, BLACK, (cx + i, eye_y), 12) # блики (разные смещения вручную) circle(screen, WHITE, (cx - 50, eye_y - 5), 4) circle(screen, WHITE, (cx + 40, eye_y - 5), 4) # NOSE (через цикл из одного элемента) for i in range(1): ny = cy - 90 polygon(screen, NOSE, [ (cx, ny), (cx - 12, ny + 14), (cx + 12, ny + 14) ]) # MOUTH (разбито и дублировано) line(screen, BLACK, (cx, ny + 14), (cx, ny + 28), 2) for i in range(2): if i == 0: arc(screen, BLACK, (cx - 30, ny + 20, 30, 20), math.pi, 2*math.pi, 2) else: arc(screen, BLACK, (cx, ny + 20, 30, 20), math.pi, 2*math.pi, 2) # WHISKERS (перегружено переменными) for side in [-1, 1]: for angle in [-10, 0, 10]: rad = math.radians(angle) x1 = cx + side * 10 y1 = ny + 10 x2 = cx + side * (10 + 120 * math.cos(rad)) y2 = ny + 10 + 40 * math.sin(rad) line(screen, BLACK, (x1, y1), (x2, y2), 2) # FRONT PAWS (через странный список) paws = [(-120, 160), (30, 160)] for p in paws: ellipse(screen, GRAY, (cx + p[0], cy + p[1], 90, 50)) # BACK PAWS (копипаста) for i in range(2): if i == 0: ellipse(screen, GRAY, (cx - 180, cy + 200, 120, 70)) else: ellipse(screen, GRAY, (cx + 60, cy + 200, 120, 70)) # TAIL (бессмысленный цикл) for _ in range(5): if _ == 4: circle(screen, GRAY, (cx + 160, cy + 80), 30) pygame.display.update() running = True while running: clock.tick(FPS) # лишний цикл обработки событий events = pygame.event.get() for i in range(len(events)): if events[i].type == pygame.QUIT: running = False pygame.quit()