HubNet Shell model

No preview image

1 collaborator

Screen_shot_2021-10-29_at_8.40.47_am Corey Brady (Author)

Tags

hubnet 

Tagged by Reuven M. Lerner almost 12 years ago

Model group SingaporeSST | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0RC10 • Viewed 379 times • Downloaded 29 times • Run 0 times
Download the 'HubNet Shell model' 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

breed [ students student ]

students-own [ user-id ]

to setup
  clear-all
  hubnet-reset
  reset-ticks
end 

to go
  every .1
  [
    listen-clients
    tick
  ]
end 

to listen-clients 
  while [ hubnet-message-waiting? ]
  [
   hubnet-fetch-message
   
   ifelse ( hubnet-enter-message? ) 
   [ ;it's an enter message
     create-new-student-turtle
   ]
   [
     ifelse (hubnet-exit-message?)
     [ ;it's an exit message
       ask students with [ user-id = hubnet-message-source ][ die ]
     ]
     [
       ;it's not either an enter or exit message...
       ;just show what it is...
       show ( word "Message from " hubnet-message-source " with tag = " hubnet-message-tag " and contents " hubnet-message )
       output-print ( word "Message from " hubnet-message-source " with tag = " hubnet-message-tag " and contents " hubnet-message )
     ]
   ]
  ]
end 

to create-new-student-turtle
  create-students 1
  [
   setxy random-xcor random-ycor 
   set user-id hubnet-message-source
  ]
end 

to send-data-to [ a-user a-widget a-value ]
  show a-user
  show count students with [ user-id = a-user ]
  ask students with [ user-id = a-user ]
  [
    hubnet-send user-id a-widget a-value
  ]
end 

There is only one version of this model, created over 12 years ago by Corey Brady.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.