tgsoli.blogg.se

Netlogo code
Netlogo code












netlogo code
  1. #NETLOGO CODE PATCH#
  2. #NETLOGO CODE CODE#
  3. #NETLOGO CODE DOWNLOAD#
  4. #NETLOGO CODE FREE#

Therefore, this procedure is needed in order to get either TRUE or FALSE to be used in the the position of the character in the given string) or 'FALSE' (in case the item is not present in the the 'position' command (used by the 'position-of-next-space' procedure) reports either a number (i.e. This reporter is needed as a condition for the while loop in 'convert-user-string'. To-report more-than-one-number-in-string? Let next-number-as-string (substring temp-string 0 position-of-next-space temp-string) Set list-of-numbers (list) Initiating this variable as a list in order to be able to use 'lput'.

#NETLOGO CODE CODE#

At that point, the last line of code adds what is left of the string (i.e. the 'more-than-one-number-in-string? temp-string'condition evaluates as 'FALSE' and the while loop

netlogo code netlogo code

When there is only one number left in the string (identified by the absence of spaces in the string), string up to the next non-space character. value to 'list-of-numbers' by using 'read-from-string' and 'lput'. space), the while loop extracts the first number with 'substring' and then assigns it as a numeric As long as there are at least two numbers in the string (identified by the presence of at least one user input intact - hence we use this 'temp-string' to trim the string without worries. missing something here) but also because you might want to keep the value of the

#NETLOGO CODE FREE#

'user-string' directly (I am not sure why, anyone please feel free to say if I'm the 'trim-string-to-next-nonspace' procedure won't let me change the value of Temp-string A temporary variable being the alter-ego of 'user-list'. List-of-numbers The list where values from the input string will be stored. Observer> show convert-user-string user-string Set list-of-numbers lput (read-from-string temp-string) (list-of-numbers) Set list-of-numbers lput (read-from-string next-number-as-string) (list-of-numbers) Let next-number-as-string (substring temp-string 0 position " " temp-string) Show word "The same is not true for " a-number-that-I-don't-like Show word "The best number is " a-cool-number You can name a procedure anything, and then put the name in a set of commands for turtles/patches The turtles/patches will run those commands then return to the first procedure and run the remainder of the commands.Abs (varA - item 1 some-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) (item 0 current-inner-list = year) AND (abs (varA - item 1 current-inner-list) test-ask-command

#NETLOGO CODE PATCH#

Patches are identified by their x-coordinate and y-coordinate Turtles are numbered but also have coordinates.Īsk turtles with Īsk turtles with != means without/not equal toĪsk patches with Īsk turtles of patch-here = green ]Īsk patches ]Ī turtle can interact with the patch by asking about it's variables with, for ex, patch-hereĪ patch can determine if there are turtles on it by asking any? turtles-here Random-xcor and random-ycor (for turtles), random-pxcor and random-pycor (for patches)Īsk turtle 13 ask turtles-at 5 5 Set is used for individual variables like color/pcolor (turtle/patch), xcor/pxcor (turtle/patch), heading, etc. Common codes & examples (click here for the complete dictionary)Ĭan use any number, decimals, generate random numbers, ie 10, 5.5, random 50Īsk turtles ask patches = if is followed by a set of conditions then the commands set in are run if they are met Add a chunk of code for each button: Click on on the "Procedures" tab and add the following code:Ĭreate-turtles 25 Īsk patches Add a 'go' button: Add another button, type go in the commands box, and check the "Forever" boxĪ. Add a 'setup' button (click for image): Under the Interface tab, click on +Add at the top type setup in the commands boxī. Templates (click here for the complete user manual)Ī. Useful sample models, select "Run model in your browser"

  • Segregation and Integration model and exhibit.
  • #NETLOGO CODE DOWNLOAD#

    Chance ( download model, File>Save Page As> ogo, save to desktop and then run in Netlogo).














    Netlogo code