User Interaction Example

User Interaction Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 298 times • Downloaded 47 times • Run 1 time
Download the 'User Interaction Example' modelDownload this modelEmbed this model

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.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago User Interaction Example Download this version
Uri Wilensky over 14 years ago User Interaction Example Download this version

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.