// STAR1 - draw a five-pointed star.
// ptlen is the distance from center to end of a star point.
// rotate_amount  allows rotation of star to the given angle..  0 = straight up

to star1 :ptlen :rotate_amount

  // save turtle position, direction, etc...
  set t1 = turtle		

  logo turtledir :rotate_amount

  // compute the length of one side segment...
  set sidelen = calc :ptlen * 0.8	

  // move to top point...
  pu fd :ptlen pd 

  // get pointed in the right direction to start..
  lt 160	

  // do the 5 points..
  repeat 5 				
    [fd :sidelen rt 68 fd :sidelen lt 140]

  // leave pen up and restore turtle position, direction, etc.
  pu					
  logo turtle = :t1			
end


// this provides a visible result if this file is executed alone..
demo star1 100 0
