我正在尝试制作一个创建谢尔宾斯基三角形的程序,但我不断收到语法错误。这是我到目前为止所拥有的:
import sys, pygame, random, math, array
pygame.init()
w, h = size = 400, 400
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Project 1, Spierpinski triangle")
verticies = [(1,h - 1), (int(w/2), 1), (w-1,h-1)]
for v in verticies:
screen.set_at(v, (0,0,255))
yRand = random.randint(0,h-1)
xRand = (random.randint(yRand,(w - yrand)*2)
point = [yRand,xRand]
for i in range(50000):
v = random.choice(verticies)
point = (int((point[0] + v[0])/2), int((point[1] + v[1])/2))
screen.set_at(point,(255,255,255))
我得到一个语法错误点