hs-logo

Logo turtle graphics interpreter

Examples

Examples are taken from the Logo 15-word challenge. Some of them have been adapted because the interpreter doesnt support all the primitives yet.

brownian_motion.logo

repeat 10000 [setpencolor random 15 fd 3 * (-1 + random 2) rt 90 * random 4]
brownian_motion.logo

bullring.logo

for [i 0 1002 1] [fd 8 seth (360 * ((:i ^ 3) / 1002))]
bullring.logo

dahlia.logo

repeat 8 [rt 45 repeat 6 [repeat 90 [fd 2 rt 2] rt 90]]
dahlia.logo

design1.logo

repeat 18 [repeat 5 [rt 40 fd 100 rt 120] rt 20]
design1.logo

fan_flower.logo

repeat 12 [repeat 75 [fd 100 bk 100 rt 2] fd 250]
fan_flower.logo

feathers1.logo

repeat 12 [setpencolor repcount repeat random 50 [fd 100 bk 95 rt 2] rt 180]
feathers1.logo

feathers2.logo

repeat 50 [repeat random 100 [fd 300 bk 295 rt 2] rt 180]
feathers2.logo

five_rose.logo

dotimes [ i 1800 ] [ fd 10 rt :i + 0.1 ]
five_rose.logo

gillyflower.logo

repeat 450 [fd (73 * sin repcount) rt 88 * cos (73 * sin repcount)]
gillyflower.logo

growing_scrolls1.logo

for [i -1 4 1] [repeat 720 [fd 2 ^ :i rt repcount]]
growing_scrolls1.logo

growing_scrolls2.logo

for [i -1 15 1] [repeat 720 [fd 1.2 ^ :i rt repcount] lt 45]
growing_scrolls2.logo

growing_scrolls3.logo

for [i 1 14 6] [repeat 720 [fd :i rt repcount]]
growing_scrolls3.logo

growing_scrolls4.logo

for [i 1 18 2] [repeat 720 [fd :i rt repcount] lt 45]
growing_scrolls4.logo

hairy_star.logo

for [i 0 4700 1] [fd 10 rt (180 * sin (:i * :i))]
hairy_star.logo

hexagon.logo

for [ i 100 30 -50 ] [ repeat 6 [ repeat 6 [ fd :i lt 60 ] lt 60 ] ]
hexagon.logo

hexagon1.logo

for [ size 20 80 20 ] [ repeat 6 [ repeat 6 [ fd :size rt 60 ] rt 60 ] ]
hexagon1.logo

hexagon2.logo

for [ i 100 10 -5 ] [ repeat 6 [ repeat 6 [ fd :i lt 60 ] lt 60 ] ]
hexagon2.logo

hypercube.logo

repeat 8 [repeat 4 [rt 90 fd 100] bk 100 lt 45]
hypercube.logo

jaggy_star.logo

for [i 0 2200 1] [fd (25 * sin :i) rt (:i * :i)]
jaggy_star.logo

low.logo

for [i 0 32 1] [repeat :i [fd :i rt 358 / :i] bk sqrt :i]
low.logo

moire.logo

setpencolor 1 repeat 180 [fd 500 bk 500 rt 2]
moire.logo

octa_star_spiral.logo

for [ l 0 120 4 ] [ repeat 8 [ fd :l rt 135 ] fd :l rt 30 ]
octa_star_spiral.logo

penta_star_spiral.logo

for [ l 0 95 3 ] [ repeat 5 [ fd :l rt 144 ] fd :l rt 30 ]
penta_star_spiral.logo

pentagon.logo

for [ i 100 10 -10 ] [ repeat 5 [ repeat 5 [ fd :i lt 72 ] lt 72 ] ]
pentagon.logo

pentahexagon.logo

repeat 5 [ repeat 6 [ fd 100 lt 72 ] lt 144 ]
pentahexagon.logo

pentahexagon1.logo

for [ i 100 10 -5 ] [ repeat 5 [ repeat 6 [ fd :i lt 72 ] lt 144 ] ]
pentahexagon1.logo

polygon1.logo

repeat 8 [repeat 20 [lt 170 fd 20 rt 170 fd 20] rt 45]
polygon1.logo

polygon2.logo

for [ l 10 80 5 ] [ repeat 5 [ repeat 8 [ fd :l rt 45 ] rt 72 ] ]
polygon2.logo

random_lines.logo

repeat random 1000 [fd random 1000 rt random 360]
random_lines.logo

rose1.logo

for [t 0 180 3] [seth :t fd 200 * sin :t home]
rose1.logo

rose2.logo

for [t 0 180 1] [seth :t fd 200 * sin :t * 7 home]
rose2.logo

rose3.logo

repeat 9 [for [i 10 200 10] [fd :i bk :i rt 2]]
rose3.logo

rotating_circle.logo

repeat 400 [repeat 34 [fd 12 rt 10] rt 90]
rotating_circle.logo

scribble.logo

repeat 1000 [fd 3 rt random 20 * (1 + sin (10 * repcount))]
scribble.logo

shell.logo

for [ scr 0.2 1.75 0.05 ] [ repeat 360 [ fd :scr rt 1 ] ]
shell.logo

simple_flower.logo

repeat 11 [for [i 0 359 1] [fd 1 rt (sin :i / 2)]]
simple_flower.logo

slalom_scroll.logo

for [i 0 2000 1] [fd 5 rt (90 * sin :i)]
slalom_scroll.logo

snowflake.logo

setpensize 4
to side :size :level
ifelse :level = 0
  [ fd :size ]
  [ side :size / 3 :level - 1
    lt 60
    side :size / 3 :level - 1
    rt 120
    side :size / 3 :level - 1
    lt 60
    side :size / 3 :level - 1
  ]
end
lt 30
repeat 3 [side 250 4 rt 120]
snowflake.logo

spin_wheel1.logo

repeat 25 [repeat 15 [fd 100 bk 100 rt 5] fd 100]
spin_wheel1.logo

spin_wheel2.logo

repeat 12 [repeat 15 [fd 100 bk 95 rt 10] fd 100] 
spin_wheel2.logo

spin_wheel3.logo

repeat 24 [repeat 25 [fd 100 bk 100 rt 15] fd 100]
spin_wheel3.logo

spiral.logo

for [ i 0.01 4 0.05 ] [ repeat 180 [ fd :i rt 1 ] ]
spiral.logo

sun.logo

repeat 2000 [pu home seth random 361 setpencolor random 15 fd 40 pd fd random 200]
sun.logo