Teken met dit script een kerstkrans op je rekenmachine! Je hoeft het script alleen maar uit te voeren.
from math import * from kandinsky import * from time import * from random import * def veg(x,y,c): for i in range(int(200*pi)): if c: f=cos(4*pi*(i/100))+sin(3*pi*(i/100)) else: f=cos(4*pi*(i/100))+sin(3*(i/100)) set_pixel(int(x+f*cos(i/100)*7),int(y+f*sin(i/100)*7),(0,50,0)) def cir(x,y,r,c,col1=0): if c==1: col1=(255,0,0) col2=(255,120,0) elif c==0: col1=(255,120,0) col2=(255,0,0) for i in range(x-r,x+r+1): for k in range(y-r,y+r+1): if sqrt((i-x)**2+(k-y)**2)<r: set_pixel(i,k,col1) if c<2: fill_rect(x-r,y-2,r*2+1,4,col2) fill_rect(0,0,44,222,(60,60,60)) fill_rect(44,0,20,222,(100,100,100)) fill_rect(64,0,192,222,(88,41,0)) fill_rect(256,0,20,222,(100,100,100)) fill_rect(276,0,44,222,(60,60,60)) fill_rect(168,16,72,78,(255,255,0)) fill_rect(80,110,72,78,(255,255,0)) cir(231,211,9,2,(150,150,150)) fill_rect(223,211,17,11,(150,150,150)) fill_rect(197,215,34,7,(115,115,115)) cir(197,220,5,2,(115,115,115)) for i in range(72): for k in range(78): set_pixel(i+80,k+16,(255,255,128-int(i/72*64+k/78*64))) set_pixel(i+168,k+110,(255,255-int(i/72*30+k/78*30),0)) for i in range(5): fill_rect(0,20+45*i,44,3,(40,38,36)) fill_rect(276,20+45*i,44,3,(40,38,36)) for i in range(3): fill_rect(15,20+90*i,3,45,(40,38,36)) fill_rect(305,20+90*i,3,45,(40,38,36)) for i in range(4): fill_rect(78,22*i**3-99*i**2+157*i+14,76,2,(0,0,0)) fill_rect(166,22*i**3-99*i**2+157*i+14,76,2,(0,0,0)) fill_rect(20*i**3-90*i**2+144*i+78,16,2,78,(0,0,0)) fill_rect(20*i**3-90*i**2+144*i+78,110,2,78,(0,0,0)) fill_rect(10,105,19,35,(30,30,30)) cir(19,122,7,2,(120,120,120)) cir(19,122,5,2,(50,50,50)) for i in range(int(1000*pi)): for k in range(8): f=5+sin(2*pi*(i/100)) x=int(160+(k+1)/2+f*cos(i/100)*12) y=int(110+k/2+f*sin(i/100)*12) c=get_pixel(x,y) set_pixel(x,y,(max(c[0]-50,0),max(c[1]-50,0),max(c[2]-50,0))) for i in range(int(1000*pi)): for k in range(7): f=5+sin(2*pi*(i/100)) set_pixel(int(158+(k+1)/2+f*cos(i/100)*12),int(108+k/2+f*sin(i/100)*12),(0,150,0)) veg(95,80,0) veg(195,170,1) veg(175,60,1) cir(147,169,10,1) cir(138,55,10,1) cir(219,99,10,0) cir(98,119,10,0) lx=[179,124,169,190,105,121,210,217,93,111,200,114,159,195,125,169] ly=[172,168,159,148,148,145,144,126,100,88,78,70,59,56,46,42] while 1: for i in range(16): r=randint(0,1) if r: c=(255,100,100) else: c=(0,0,255) fill_rect(lx[i],ly[i]+1,4,2,c) fill_rect(lx[i]+1,ly[i],2,4,c) sleep(0.25)