📄 tree.bas
字号:
#!/usr/local/bin/sbrun -g' treerandomize timerdim si(10),sx(10),sy(10),st(10)dim shf(10),sa(10),sb(10),sh(10)dim sd(10)' TREE DATArand=1if left$(osname,1)="U" then ' UNIX brafan=ymax/5 inpfac=.75 inphf=.8 depth=6 density=5else ' PalmOS brafan=xmax/3.2 inpfac=1 inphf=1 depth=4 density=3fi'l=pi/180a=90:h=ymax/4:nx=xmax/2:ny=1clsif bpp>4 flowercolor=12else flowercolor=10ficolor 2pset xmax/2, ymaxgosub treeendLABEL treeif depth=0 ' flower color flowercolor pset nx-2,ymax-ny pset nx,ymax-(ny+3) pset nx+2,ymax-ny pset nx,ymax-ny color 2else si(sp)=i:sx(sp)=x:sy(sp)=y st(sp)=th:shf(sp)=hf sp=sp+1 start=a-brafan/2 th=brafan/density if depth<=2 hf=inphf/2 else hf=inphf fi x=h*cos(a*l):y=h*sin(a*l) a=start i=1500 nx=nx+x:ny=ny+y line nx,ymax-ny gosub brrand gosub tree a=sa(sp):brafan=sb(sp) h=sh(sp):depth=sd(sp) a=a+th nx=nx-x:ny=ny-y pset nx,ymax-ny i=i+1 if i<=density+1 then 500 sp=sp-1 i=si(sp):x=sx(sp):y=sy(sp) th=st(sp):hf=shf(sp) brafan=sb(sp)fireturn LABEL brrandsa(sp)=a:sb(sp)=brafansh(sp)=h:sd(sp)=depthif rand=0 brafan=brafan*inpfac h=h*hfelse a=a-th/2+rnd*th+1 brafan=brafan*inpfac h=h*hf*rndfidepth=depth-1return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -