User Interaction Example
Model was written in NetLogo 5.0.4
•
Viewed 298 times
•
Downloaded 47 times
•
Run 1 time
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [name] to go ;; user-input lets the user type in a string if name = 0.0 ;; has name been set yet? [ set name user-input "What is your name?" ] ;; read-from-string will convert a string into a number let num read-from-string user-input "How many turtles would you like?" ;; user-choice gives the user a set of choices ;; runresult runs a NetLogo reporter held in a string let col runresult user-one-of "What color should the turtles be?" ["red + 1" "blue - 2" "green + 3"] ;; make the turtles crt num [ set color col fd random-float max-pxcor ] ;; user-message tells the user something user-message (word "OK, " name ", there are " count turtles " turtles now.") ;; user-yes-or-no? asks the user a yes-or-no question if not user-yes-or-no? "Would you like more turtles?" [ stop ] end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
User Interaction Example.png | preview | Preview for 'User Interaction Example' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.