Код игры "Змейка" на питоне: import pygame import random pygame.init() Создаем окно для игры screen_width = 800 screen_height = 600 screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption('Змейка') Создаем цвета, используемые в игре black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) green = (0, 255, 0) dark_green = (0, 215, 0) Создаем змейку snake_pos = [100, 50] snake_body = [[100, 50], [90, 50], [80, 50]] direction = 'RIGHT' Создаем еду для змейки food_pos = [random.randrange(1, screen_width // 10) * 10, random.randrange(1, screen_height // 10) * 10] food_spawn = True Создаем основной цикл игры clock = pygame.time.Clock() game_over = False while not game_over: # Обрабатываем события for event in pygame.event.get(): if event.type == pygame.QUIT: game_over = True elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT and direction != "LEFT": direction = 'R