Client Perspective Example
Model was written in NetLogo 5.0RC10
•
Viewed 523 times
•
Downloaded 74 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Click to Run Model
breed [students student] students-own [ user-id step-size ] to startup hubnet-reset end to setup clear-patches clear-drawing clear-output ask turtles [ set step-size 1 hubnet-send user-id "step-size" step-size ] reset-ticks end to go listen-clients every 0.1 [ tick ] end ;; ;; HubNet Procedures ;; to listen-clients while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-student ] [ ifelse hubnet-exit-message? [ remove-student ] [ ask students with [user-id = hubnet-message-source] [ execute-command hubnet-message-tag ] ] ] ] end to create-new-student create-students 1 [ set user-id hubnet-message-source set label user-id set step-size 1 pen-down send-info-to-clients ] end to remove-student ask students with [user-id = hubnet-message-source] [ die ] end to execute-command [command] if command = "step-size" [ set step-size hubnet-message stop ] if command = "up" [ execute-move 0 stop ] if command = "down" [ execute-move 180 stop ] if command = "right" [ execute-move 90 stop ] if command = "left" [ execute-move 270 stop ] end to send-info-to-clients ;; turtle procedure hubnet-send user-id "location" (word "(" pxcor "," pycor ")") end to execute-move [new-heading] set heading new-heading fd step-size send-info-to-clients 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 7 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Client Perspective Example.png | preview | Preview for 'Client Perspective Example' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.