ドラゴン
ドリトルで描くドラゴン曲線
ドラゴン2態
http://bitarrow.eplang.jp/bitarrow/fs/pub/f4e9c680/Dragon_1.html
http://bitarrow.eplang.jp/bitarrow/fs/pub/f4e9c680/Dragon_2.html
// Dragon 1
t=turtle!create.
dragon=[| level w; nw |
[level <= 0 ] ! then [
t! (w) forward.
] else [
nw = w/sqrt(2).
t! (45) leftturn.
! (level-1)(nw) dragon.
t! (90) rightturn penup (nw) forward (180) leftturn pendown.
! (level-1)(nw) dragon.
t! (180) leftturn penup (nw) forward pendown (45) leftturn.
] execute.
].
t ! penup (-200)(-80) position (2) linewidth (red) linecolor.
! (4)(500) dragon. t! makefigure.
t ! penup (-200)(-80) position (2) linewidth (blue) linecolor.
! (9)(500) dragon. t! makefigure.
// Dragon 2
screen! (red! darker) paint.
t=turtle!create.
dragon=[| level w; nw |
[level <= 0 ] ! then [
t! (w) forward.
] else [
nw = w/sqrt(2).
t! (45) leftturn.
! (level-1)(nw) dragon.
t! (90) rightturn penup (nw) forward (180) leftturn pendown.
! (level-1)(nw) dragon.
t! (180) leftturn penup (nw) forward pendown (45) leftturn.
] execute.
].
t ! penup (-200)(-80) position (2) linewidth (yellow) linecolor.
! (14)(500) dragon. t! makefigure.