;;; arabesque.nlogo, cr 16 apr 2006 by rha on hypatia ;;; imitate john whitney sr pascal code ;;; with verbose comments 15 jan 2008 by rha on thales2 ;;;;;;;;;;;; interface;;;;;;;;;;; ;;; usual three buttons (go is forever) and graphics window: ;;; torus 35 x 35, origin in center, 12 x 12 pixel patches ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ mylist ] ;;; global variable declaration is a list of one to setup ;;; the setup button calls this procedure ca ;;; clear-all, resets everything set mylist n-values 360 [?] ;;; initialize the sole global variable ;;;;;;;; NOTE: mylist is initialized as a list of natural numbers 0,...,259 ;;;;;;;; read about "n-values" in the NetLogo Dictionary crt 360 ;;; create 360 random turtles foreach mylist [ ;;; traverse my list and apply to each of its numbers --- ask turtle ? [ ;;; for each n ask turtle n to run three turtle commands set color red set heading ? ;;; here "?" means the number of the turtle (so turtles radiate) forward 15 ;;; makes a circle of turtles or radius 15 (almost fills the graphics window) ] ;;; end of inner group (ask) ] ;;; end of outer group (foreach) end ;;;;;; end of setup procedure to step ;;; the step button calls this main procedure let stepsize 0.01 ;;; NOTE the special word "let" declares a local variable (and sets it) foreach mylist [ ;;; as above ask turtle ? [ ;;; as above set heading 90 ;;; right-angle turn clockwise forward ? * stepsize ;;; size of move ahead is turtle number times stepsize ] ] end to go ;;; the go (gorever) button: one press calls step repeatedly step ;;; another press stops it end ;;; end of to procedure ;;; end: arabesque