Tag: stochastic

2D Stochastic Cutted Fractal Tree with Pygame

import pygame, math, random pygame.init() window = pygame.display.set_mode((800, 800)) pygame.display.set_caption(“Stochastic Cutted Fractal Tree”) screen = pygame.display.get_surface() def drawTree(x1, y1, angle, depth, r,g,b): if depth: # Brown to green gradient g=g+7; if g>255: g=7 x2 = x1 + int(math.cos(math.radians(angle)) * random.randint(10,30))

Posted in Maths, Programming, Python Tagged with: , , , ,
%d bloggers like this: