-----------------------------

to main; Dome by Olga
3d_frame
setpensize[2 2] draw 50 0
end

to draw :rad :x
if :rad<10[stop]
setpc(list 3.19*:x 3.19*:x 0)
sph :x/2-50 -65 0
dome :rad
draw :rad-.5 :x+1
end

to dome :rad
lt  90 arc2 180 :rad
rt 180 arc2 -90 :rad
rt 180 arc2 -90 :rad
rt 180 arc2 180 :rad
end

to procs
ed[main draw dome procs]
end
------------------------------

to main ; Superstar by Olga
3d_frame
setpensize[2 2]
repeat 100[star repcount]
end

to star :size
setpc(se 258-2.57*:size 0 0)
repeat 4[arc2 90 :size rt 180]
bk 1
end

to procs
ed[main star procs]
end
------------------------------

to main ; Comet by Olga
3d_frame setpensize[2 2]
sp -80 -80
draw1 85 0
draw2 50 0
end

to draw1 :rad :times
if :rad<50[stop]
setpc(se 3.6*:times 0 0)
flame :rad
draw1 :rad-.5 :times+1
end

to draw2 :rad :times
if :rad<1[stop]
setpc(se 255-2.6*:times 2.6*:times 0)
flame :rad
draw2 :rad-.5 :times+1
end

to flame :rad
arc2  90 :rad rt 180
arc2 -90 :rad
arc2  90 :rad*2
rt 90
end

to procs
ed[main draw1 draw2 flame procs]
end
---------------------

to main ; Eclipse by Yehuda
3d_frame
setpensize[2 2]
rt 180 draw 255
end

to draw :count
if :count<9[stop]
sphc 0 0 :count*360/255 (se :count 0 0)
arc2 180 40
draw :count-1
end

to procs
ed[main draw procs]
end
------------------------

to main ; Screw by Yehuda
3d_frame
setpensize[3 3] draw 0
end

to draw :x
if :x>91[stop]
setpc(se 2.8*:x abs 2.8*ycor 0)
sp :x-36 :x-46
lt 2 fd 60
draw :x+.2
end

to procs
ed[main draw procs]
end
-----------------------------

to main ; Moire by Yehuda; after a design by Dale Reed
3d_frame
sp 7 7 draw 85 4 "false
sp -8 -8 pd
draw 85 1 "true
end

to draw :rad :col :mode
setpc :col setfc :col
circle :rad
repeat 100[fd :rad bk :rad rt 360/100]
rt 360/200 pu
repeat 50[fd :rad/2 (fill :mode) bk :rad/2 rt 360/50]
end

to procs
ed[main draw procs]
end
--------------------------------

to aaa ; by Mike Sandy, Nov 2000
 cs ht
 3d_frame
 main 25 4  ;20 5 
end

to main :p.width :strands
 ;p.width = PEN WIDTH
 ;strands = NUMBER OF STRANDS(TURTLES)
 ;aaa 30  5 (col.incr=1)
 ;aaa 25  6 (col.incr=1)
 ;aaa 22  7 (col.incr=1)
 ;aaa 40  4 (col.incr=1)
 ;aaa 55  3 (col.incr=1)
 ;ct
 window

 setpensize (list 0 :p.width)
 let[[height 88]               ;AMPLITUDE OF PLOT
     [col.incr 1]               ;LENGTH OF COLOUR SEGMENT
     [cycles 1]                 ;NUMBER OF CYCLES
                                ; OF TRIANGULAR SINE IN PLOT
     [range 240]                ;PLOT WIDTH
     [xi -1.2*:range/2]         ;INITIAL X
     [xf .8*:range/2]           ;FINAL X
     [display.range :range*.75]  ;DISPLAY RANGE; TIDIES UP ENDS
     [xdi -1*:display.range/2]
     [xdf .98*:display.range/2]
     [coord.a (array :strands 0)] ;INITIAL VALUES OF STRANDS
     [period  int (:xf-:xi)/:cycles]
     [m 4*:height/:period]      ;GRADIENT OF FUNCTION
     [f.offset 1/:strands]
     [seg.f.incr 1/(2*:strands)]
     [pen.col 0]
     [col.num 1]
    ]
 fill.array :strands-1 
 ;icon "commander
 (repeat :strands
   [setturtle repcount-1
    ht pu])
 loop 0 1 0 :strands*:cycles
end

to plot :x :xf :f.offset :col.incr :col.num 
 if :x>:xf[pu setpc :pen.col stop]
 tri.fn :x :f.offset
 setpc -1*pc+2+remainder :col.num*3+2*:i 11    
 (ifelse and :x>:xdi :x<:xdf
       [pd][pu])
 plot :x+:col.incr :xf :f.offset :col.incr :col.num 
end

to move :i 
 localmake "u0 item :i :coord.a
 (ask :i
    [plot :u0 :u0+:seg.f.incr*:period :i*:f.offset 
          :col.incr
          :col.num*(1+remainder :i :strands) 
     setitem :i :coord.a 
             :u0+:seg.f.incr*:period
                ;UPDATES START VALUES
                ;FOR NEXT PLOT OF :i
     setpc :pen.col
       ])
end

to fill.array  :i
 (if :i=0 
   [setitem :i :coord.a
             :xi+:period*:seg.f.incr/2
    stop])
 (setitem :i :coord.a
          :xi+:period*:seg.f.incr*(2*:i-1)/2)
 fill.array :i-1
end

to loop :i :it :ov.und :count ;:COUNT=2*:cycles
 if :count=0[stop]
 (if :i=:it 
    [move :i         
     move remainder :i+1 :strands  
     loop remainder :i+1 :strands
          remainder :it+2 :strands
          0 :count-1
          stop])
 (ifelse 0=:ov.und
     [move :i move :it  ]
     [move :it move :i  ])
 loop :i remainder :it+1 :strands  -1*:ov.und+1 :count
end

to tri.fn :x :f.offset
 local[ xr len]
 make "xr modulo int :x-:xi-:f.offset*:period :period
 (ifelse :xr<:period/2
    [setxy :x :m*(:xr-:period/4)]
    [setxy :x :m*(3*:period/4-:xr)])
end

to procs
 ed[aaa main plot move
    fill.array
    loop
    tri.fn
    procs]
end
--------------------------------