本帖最后由 happy886rr 于 2017-4-15 00:14 编辑
回复 19# 523066680
酷语言分形
1.地毯(图片均为外链)
2.树
3.圆
.
.
请使用CLGO解释器3.0版运行。下载地址:http://www.bathome.net/thread-43178-1-1.html- ::*****************************************************************************
- @ECHO OFF&MODE CON COLS=100 LINES=30&CLGO "%~F0"&PAUSE>NUL&EXIT /B
- ::*****************************************************************************
-
- /*
- 谢尔宾斯基地毯,酷码;
- */
-
- //入口函数
- TO MAIN
- FOR :A 1 6
- CS
- WAIT 10
- MAKE :PENX=-330 :PENY=220
- TEXT 22 3 8 微软雅黑 Sierpinski-Level:{:A}
- MAKE :PENX=-200 :PENY=-200 :PENC=6 :PENW=10 :PENS=0
- XEBD 380 :A
- WAIT 500
- ]
-
- //谢尔宾斯基主循环
- TO XEBD :L :N
- REPEAT 4
- FD :L
- RT 90
- ]
-
- XK :L
- XEB :L/3 :N-1
-
- //地毯分循环
- TO XEB :L :N
- IF :N=0
- STOP
- ]
-
- XK :L
- XEB :L/3 :N-1
-
- REPEAT 2
- PU
- FD :L
- PD
- XK :L
- XEB :L/3 :N-1
- ]
-
- REPEAT 2
- PU
- RT 90
- FD :L
- LT 90
- PD
- XK :L
- XEB :L/3 :N-1
- ]
-
- REPEAT 2
- PU
- BK :L
- PD
- XK :L
- XEB :L/3 :N-1
- ]
-
- PU
- LT 90
- FD :L
- RT 90
- PD
- XK :L
- XEB :L/3 :N-1
-
- PU
- LT 90
- FD :L
- RT 90
- PD
-
- //细节补枝
- TO XK :L
- PU
- FD :L/3
- RT 90
- FD :L/3
- LT 90
- PD
-
- REPEAT 4
- FD :L/3
- RT 90
- ]
-
- MAKE :PENC=RAND(15)+1
- PU
- BK :L/3
- LT 90
- FD :L/3
- RT 90
- PD
复制代码
- ::*****************************************************************************
- @ECHO OFF&MODE CON COLS=100 LINES=30&CLGO "%~F0"&PAUSE>NUL&EXIT /B
- ::*****************************************************************************
-
- //入口函数
- TO MAIN
- FOR :A 2 12
- CS
- WAIT 10
- MAKE :PENX=-330 :PENY=220
- TEXT 22 3 8 微软雅黑 Sierpinski-Level:{:A}
- MAKE :PENX=0 :PENY=-200 :PENC=6 :PENW=2 :PENS=2
- TREE 100 :A 20 0.75
- WAIT 50
- ]
-
-
-
- TO TREE :L :N :ANGEL :RATE
- IF :N=0
- STOP
- ]
- FD :L
- RT :ANGEL
- TREE :L*:RATE :N-1 :ANGEL :RATE
- LT :ANGEL*2
- TREE :L*:RATE :N-1 :ANGEL :RATE
- RT :ANGEL
- BK :L
- MAKE :PENC=RAND(15)+1
复制代码
|