9
16 maggio 2006Master in economia e politica sanitaria - Simulazione per la sanità 9 impariamo NetLogo 3D2 esempio dal manuale D.nlogo interazione con il terreno to move-turtles ask turtles [ set heading (random 360) fd 1 ] end ; -of ;Reports the value of the VARIABLE of the given agent. ;Can also be used to set the value of the variable. ; uphill patch-variable ;Reports the turtle heading (between 0 and 359 degrees) in the direction of the maximum value ;of the variable patch-variable, of the patches in a one-patch radius of the turtle. ;If there are multiple patches that have the same greatest value, a random one of those patches ;will be selected. ;patch-ahead distance ;Reports the single patch that is the given distance "ahead" of the calling turtle, that is, ;along the turtle's current heading ;; each turtle goes to the highest elevation in a radius of one to move-to-local-max ask turtles [ set heading uphill elevation if ( elevation-of patch-ahead 1 > elevation ) [ fd 1 ] ] end