Plot Mirroring Example

No preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 4.1pre4 • Viewed 396 times • Downloaded 35 times • Run 0 times
Download the 'Plot Mirroring 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.)


VERSION

$Id: Plot Mirroring Example.nlogo 40624 2008-08-14 19:26:59Z everreau $

add model documentation here

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [n plots pens]
turtles-own [user-id]

to startup
  setup
end 

to setup
  hubnet-set-client-interface "COMPUTER" []
  hubnet-reset
  ca
  setup-plots
end 

to go
  listen-clients
  do-plotting
  tick
end 

to listen-clients
  while [ hubnet-message-waiting? ]
  [
    hubnet-fetch-message
    ifelse hubnet-enter-message?
    [ new-client ]
    [
      if hubnet-exit-message?
      [ remove-client ]
    ]
  ]
end 

to new-client
  crt 1
  [
    set user-id hubnet-message-source
    setxy random-float world-width random-float world-height
    rt 360.0
  ]
end 

to remove-client
  ask turtles with [user-id = hubnet-message-source]
  [ die ]
end 

to setup-plots
  set plots ["plot1" "plot2" "plot3"]
  set pens ["pen1" "pen2" "pen3" "pen4" "pen5"]
end 

to do-plotting
  ;; Chose a random plot and pen to plot
  set-current-plot one-of plots
  set-current-plot-pen one-of pens
  if random 100 < 10 ;color-change
  [ set-plot-pen-color random 140 ]
  if random 100 < 5 ;mode-change
  [ set-plot-pen-mode random 3 ]
  if random 100 < 5 ;interval-change
  [ set-plot-pen-interval 1 + random 10 ]
  if random 100 < 5 ;range-change
  [ set-plot-x-range (random 50) (50 + random 50)
    set-plot-y-range (random 50) (50 + random 50)
  ]
  if random 100 < 20 ;plot-pen-up/down-change
  [ ifelse random 2 = 0
    [ plot-pen-up ]
    [ plot-pen-down ]
  ]
  if random 100 < 10 ;auto-plot-change
  [ ifelse autoplot?
    [ auto-plot-off ]
    [ auto-plot-on ]
  ]
  plot -50 + random 200
  if random 1000 < 20 ;histo-chance
  [ histogram [ random 100 ] of patches ]
  set n n + 1
  hubnet-broadcast "n" n
end 

There are 2 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 14 years ago Plot Mirroring Example Download this version
Uri Wilensky over 14 years ago Plot Mirroring Example Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.