小编Tia*_*art的帖子

Sierpinski的Triangle Pygame Recursive

因此,对于我目前的大学论文,我们的目的是创建一个Sierpinksi三角形,并在内部递归绘制新的三角形.

我们得到的原始代码是这样的:

import sys, pygame

# a function that will draw a right-angled triangle of a given size anchored at a given location
def draw_triangle(screen, x, y, size):
        pygame.draw.polygon(screen,white,[[x,y], [x+size,y], [x,y-size]])

############################################################################################# 
# Define a function that will draw Sierpinski's Triangle at a given size anchored at a given location
# You need to update this function 
# currently only one triangle is drawn

def sierpinski(screen, x, y, size):
        draw_triangle(screen, x, y, size)

############################################################################################# 

# Initialize the game engine
pygame.init() …
Run Code Online (Sandbox Code Playgroud)

python recursion pygame fractals

10
推荐指数
1
解决办法
1698
查看次数

Silverstripe图像有很多

我对Silverstripe很新,并一直在玩CMS.

目前我被卡住了......我正在尝试$has_many在DataObject和Images之间添加关系.

我发现做这样的事情的文件很模糊?我知道当你想在两个DataObjects之间添加一个关系时,你需要添加一个$many_many$belongs_many_many关系但是我如何用图像做这个?

我尝试将图像添加到a $has_many并简单地使用上传字段,但这只会导致错误.我还尝试保留图像$has_one并将上传字段setAllowedMaxFileNumber增加到10,但这只能保存1张图像.

在这方面的任何帮助将非常感谢:)

谢谢!

任何人都希望看到这里的代码是一个Pastebin

php oop image silverstripe relationship

5
推荐指数
1
解决办法
679
查看次数

标签 统计

fractals ×1

image ×1

oop ×1

php ×1

pygame ×1

python ×1

recursion ×1

relationship ×1

silverstripe ×1