Scratch Polygons

Compare to NetLogo turtle graphics polygon code




TO Square
   Repeat 4
   [
       fd 5
       rt 90
   ]
END

TO Octagon
   Repeat 8
   [ 
       fd 5
       rt 45
   ]
END

TO showSquares
   ca
   
   cro howManyTurtles
   
   ask turtles
   [
       fd 6
       pd
       
       octagon
       
       pu
       
       fd 8
   ]
END



See the above NetLOGO Square Dance and Octagons show code. You will need to create the SLIDER and the BUTTON, of course.