From bc88e2138a8884c4865ce34b89f96b7ecc7f0fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Wed, 18 Mar 2026 13:29:25 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=20=D0=BD=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=20=D1=85=D1=83=D0=B6=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task1.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/task1.py b/task1.py index 65ab23d..f9564e8 100644 --- a/task1.py +++ b/task1.py @@ -24,25 +24,27 @@ def draw_ear(surface, x, y, width, height, color): def draw_leg(surface, x, y, width, height, color): ''' Рисует ногу ''' ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) -def draw_hare( surface, x, y, width, height, color): +def draw_hare(srf, cx, cy, w, h, clr): ''' Рисует зайца ''' - body_width = width // 2 - body_height = height // 2 - body_y = y + body_height // 2 - draw_body(surface, x, body_y, body_width, body_height, color) + bw = w // 2 + bh = h // 2 + by = cy + bh // 2 + draw_body(srf, cx, by, bw, bh, clr) - head_size = height // 4 - draw_head(surface, x, y-head_size // 2, head_size, color) + hs = h // 4 + hy = cy - hs // 2 + draw_head(srf, cx, hy, hs, clr) - ear_height = height // 3 - ear_y = y - height // 2 + ear_height // 2 - for ear_x in (x-head_size // 4, x + head_size // 4): - draw_ear (surface, ear_x, ear_y, width // 8, ear_height, color) + eh = h // 3 + ey = cy - h // 2 + eh // 2 + for ex in (cx - hs // 4, cx + hs // 4): + draw_ear(srf, ex, ey, w // 8, eh, clr) - leg_height = height // 16 - leg_y =y + height // 2 - leg_height // 2 - for leg_x in (x - width // 4, x + width // 4): - draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color) + lh = h // 16 + ly = cy + h // 2 - lh // 2 + coords = [cx - w // 4, cx + w // 4] + for lx in coords: + draw_leg(srf, lx, ly, w // 4, lh, clr) draw_hare(screen, 200, 200, 200, 400, BROWN) From cf68650ab5daa605ac5dd582280692c9e0d0f83b Mon Sep 17 00:00:00 2001 From: 24_PetrovIA <24_PetrovIA@iux.local> Date: Wed, 18 Mar 2026 13:47:58 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20hare.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hare.py | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/hare.py b/hare.py index d132cbc..68a91d6 100644 --- a/hare.py +++ b/hare.py @@ -24,40 +24,25 @@ def draw_ear(surface, x, y, width, height, color): def draw_leg(surface, x, y, width, height, color): ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) -# ЭТА ФУНКЦИЯ СДЕЛАНА ПЛОХО def draw_hare(surface, x, y, width, height, color): - # Тело - w1 = width // 2 - h1 = height // 2 - y1 = y + h1 // 2 - ellipse(surface, color, (x - w1 // 2, y1 - h1 // 2, w1, h1)) + body_width = width // 2 + body_height = height // 2 + body_y = y + body_height // 2 + draw_body(surface, x, body_y, body_width, body_height, color) - # Голова - s2 = height // 4 - y2 = y - s2 // 2 - circle(surface, color, (x, y2), s2 // 2) + head_size = height // 4 + head_y = y - head_size // 2 + draw_head(surface, x, head_y, head_size, color) + + ear_height = height // 3 + ear_y = y - height // 2 + ear_height // 2 + for ear_x in (x - head_size // 4, x + head_size // 4): + draw_ear(surface, ear_x, ear_y, width // 8, ear_height, color) - # левое ухо - eh = height // 3 - ey = y - height // 2 + eh // 2 - ew = width // 8 - ellipse(surface, color, (x - s2 // 4 - ew // 2, ey - eh // 2, ew, eh)) - # правое ухо - ellipse(surface, color, (x + s2 // 4 - ew // 2, ey - eh // 2, ew, eh)) - - # Ноги - СТРАННЫЕ ПЕРЕМЕННЫЕ - lh = height // 16 - ly = y + height // 2 - lh // 2 - lw = width // 4 - # левая нога - ellipse(surface, color, (x - width // 4 - lw // 2, ly - lh // 2, lw, lh)) - # правая нога - ellipse(surface, color, (x + width // 4 - lw // 2, ly - lh // 2, lw, lh)) - - # НИ НА ЧТО НЕ ВЛИЯЮЩИЙ КОД - temp = 0 - for i in range(5): - temp += i + leg_height = height // 16 + leg_y = y + height // 2 - leg_height // 2 + for leg_x in (x - width // 4, x + width // 4): + draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color) # Рисуем зайца draw_hare(screen, 200, 200, 200, 300, GRAY) From ef3f80babb197db9b78666cbf839df0eb1d3a6ad Mon Sep 17 00:00:00 2001 From: 24_PetrovIA <24_PetrovIA@iux.local> Date: Wed, 18 Mar 2026 14:15:02 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20hare.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hare.py | 65 --------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 hare.py diff --git a/hare.py b/hare.py deleted file mode 100644 index 68a91d6..0000000 --- a/hare.py +++ /dev/null @@ -1,65 +0,0 @@ -import pygame -from pygame.draw import * - -pygame.init() - -FPS = 30 -screen = pygame.display.set_mode((400, 400)) - -# Цвета -WHITE = (255, 255, 255) -GRAY = (200, 200, 200) -BLACK = (0, 0, 0) -BROWN = (139, 69, 19) - -def draw_body(surface, x, y, width, height, color): - ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) - -def draw_head(surface, x, y, size, color): - circle(surface, color, (x, y), size // 2) - -def draw_ear(surface, x, y, width, height, color): - ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) - -def draw_leg(surface, x, y, width, height, color): - ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) - -def draw_hare(surface, x, y, width, height, color): - body_width = width // 2 - body_height = height // 2 - body_y = y + body_height // 2 - draw_body(surface, x, body_y, body_width, body_height, color) - - head_size = height // 4 - head_y = y - head_size // 2 - draw_head(surface, x, head_y, head_size, color) - - ear_height = height // 3 - ear_y = y - height // 2 + ear_height // 2 - for ear_x in (x - head_size // 4, x + head_size // 4): - draw_ear(surface, ear_x, ear_y, width // 8, ear_height, color) - - leg_height = height // 16 - leg_y = y + height // 2 - leg_height // 2 - for leg_x in (x - width // 4, x + width // 4): - draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color) - -# Рисуем зайца -draw_hare(screen, 200, 200, 200, 300, GRAY) - -# Глаза и нос - НАХОДЯТСЯ ВНЕ ФУНКЦИИ -circle(screen, BLACK, (170, 150), 5) # левый глаз -circle(screen, BLACK, (230, 150), 5) # правый глаз -circle(screen, BLACK, (200, 170), 3) # носик - -pygame.display.update() -clock = pygame.time.Clock() -finished = False - -while not finished: - clock.tick(FPS) - for event in pygame.event.get(): - if event.type == pygame.QUIT: - finished = True - -pygame.quit()