import pygame from my_package.Game_class import Game class TriangleTriangle(Game): def __init__(self): super().__init__() self.WHITE = (255, 255, 255) self.surface = pygame.Surface((100, 100)) def draw_triangle(self, screen, x: float, y: float, w: float, h:float): p1 = (x, y) p2 = (x + w, y) p3 = (x + w / 2, y + h) pygame.draw.polygon(screen, self.WHITE, [p1, p2, p3], 1) def draw_sierpinski(self, screen, x: float, y: float, w: float, h:float): self.draw_triangle(screen, x, y, w, h) # TODO: base case # recursive case h2 = h / 2 w2 = w / 2 self.draw_sierpinski(screen, x, y, w2, h2) self.draw_sierpinski(screen, x + w2 / 2, y + h2, w2, h2) self.draw_sierpinski(screen, x + w2, y, w2, h2)