我正在尝试创建混乱游戏。我有一个 if 语句,它调用不同的混乱事物并指出绘制它们的点。但我认为我的 if 语句有问题。
我不知道该尝试什么...
#This 'makes' the diffrent fractals
def make(self, fractal):
if (fractal == "SierpinskiTriangle"):
SierpinskiTriangle(self.dimensions)
for i in range(len(SierpinskiTriangle.verticies)):
plotPoint(i, self.vertexColor, self.vertexRadius)
for i in range(SierpinskiTriangle.numPoints):
listVertices = SierpinskiTriangle.verticies
randVert = randint(0, len(listVertices)-1)
newVertexPoint = listVertices[randVert]
m1 = Point.midpt(m1, newVertexPoint)
self.plot(m1)
elif (fractal == "SierpinskiCarpet"):
SierpinskiCarpet(self.dimensions)
for i in range(len(SierpinskiCarpet.verticies)):
plotPoint(i, self.vertexColor, self.vertexRadius)
for i in range(SierpinskiCarpet.numPoints):
listVertices = SierpinskiCarpet
randVert = randint(0, len(listVertices)-1)
newVertexPoint = listVertices[randVert]
m1 = Point.midpt(m1, newVertexPoint)
self.plot(m1)
else:
Pentagon(self.dimensions)
for i in range(len(Pentagon.verticies)):
plotPoint(i, self.vertexColor, self.vertexRadius)
for i in range(Pentagon.numPoints):
listVertices = SierpinskiCarpet
randVert = randint(0, len(listVertices)-1)
newVertexPoint = listVertices[randVert]
m1 = Point.midpt(m1, newVertexPoint)
self.plot(m1)
我希望这能调用我的课程并绘制我的观点。