This page was automatically generated by NetLogo 5.0.5.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

In order for this to work, this file, your model file (MOVIE_11._Jury_Trial.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)

powered by NetLogo

view/download model file: MOVIE_11._Jury_Trial.nlogo

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; AGENT_ZERO ;; MOVIE 11 Code. Version 1.0 ;; Jury Trial ;; ;; Joshua M. Epstein ;; December 2012 ;; Sliders [0, .02, 30, 0, 90] ;; Book Seed = 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to use-new-seed let my-seed new-seed output-print word "Generated seed: " my-seed random-seed my-seed end to use-seed-from-user let my-seed read-from-string user-input "Enter a random seed (an integer):" output-print word "User-entered seed: " my-seed random-seed my-seed end undirected-link-breed [red-links red-link] links-own [weight] turtles-own [ affect learning_rate lambda delta threshold event_count disposition probability memory ] to setup-links ask turtle 0 [ create-red-link-with turtle 1] ask red-link 0 1 [ set color red set weight 0] ask turtle 0 [ create-red-link-with turtle 2] ask red-link 0 2 [ set color red set weight 0] ask turtle 1 [ create-red-link-with turtle 0] ask red-link 1 0 [ set color red set weight 0] ask turtle 1 [ create-red-link-with turtle 2] ask red-link 1 2 [ set color red set weight 0] ask turtle 2 [ create-red-link-with turtle 0] ask red-link 2 0 [ set color red set weight 0] ask turtle 2 [ create-red-link-with turtle 1] ask red-link 2 1 [ set color red set weight 0] end to update-links ask red-link 0 1 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] ask red-link 0 2 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] ask red-link 1 0 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] ask red-link 1 2 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] ask red-link 2 0 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] ask red-link 2 1 [ set thickness 0 + weight ifelse weight = 0 [hide-link] [show-link]] end to setup __clear-all-and-reset-ticks ;use-new-seed use-seed-from-user setup-patches setup-turtles ;setup-links ;movie-start "out.mov" ; Uncomment block to make movie. ;movie-grab-view ;repeat 125 ; [ go ; movie-grab-view ] ; movie-close tick end to setup-turtles set-default-shape turtles "person" create-turtles 3 ask turtle 0 [ setxy -5 -3 set color blue set affect 0.001 set delta 0 set lambda 1 set learning_rate .05 set threshold .5 set event_count 0 set disposition 0 set probability 0 set memory [] repeat memory_length [set memory lput random-float 0 memory] ;set memory [0] ;set memory [0 0 0 0] ;set label who ] ask turtle 1 [ setxy -7 -7 set color blue set affect 0.001 set delta 0 set lambda 1 set learning_rate .035 set threshold .5 set event_count 0 set disposition 0 set probability 0 ;set memory [ 1 3 5 7 8] set memory [] repeat memory_length [set memory lput random-float 0 memory] ;show memory ; set label who ] ask turtle 2 [ setxy -10 -4 ;random-xcor random-ycor set color blue set affect 0.001 set delta 0 set lambda 1 set learning_rate .02 set threshold .5 set event_count 0 set disposition 0 set probability 0 set memory [] repeat memory_length [set memory lput random-float 0 memory] ;set memory [0 0] ;set label who ] end to setup-patches ask patches [set pcolor yellow + random 2] end to go if ticks >= 90 [stop] setup-links ; PRE-TRIAL PUBLIC PHASE Jury out in the public square ; move-turtles ; Jury doesn't move ; update-event_count if ticks < 30 [ ; activate-allPatches ask patches with [pxcor >= 1 and pycor >= -1][set pcolor gray + 2] activate-publicPatches update-affect update-probability update-disposition update-links deactivate-publicPatches] ; TRIAL PHASE. Jury moves into courtroom if ticks >= 30 [ ask turtle 0 [setxy 5 3] ask turtle 1 [setxy 7 7] ask turtle 2 [setxy 10 4] ] if ticks >= 30 and ticks < 60 [ ask patches with [pxcor < -2 or pycor < -2] [set pcolor gray + 2] ask patches with [pxcor >= -2 and pycor >= -2] [set pcolor yellow + random 2] activate-courtroomPatches update-affect update-probability update-disposition ;update-affect-weights update-links deactivate-courtroomPatches ] ; JURY PHASE. Now weights turn on.[Juror coordinates as in Phase II but brown Chamber smaller then courtroom. if ticks >= 60 [ ask patches with [pxcor > 1 and pycor > -1][set pcolor 35] ask patches with [pxcor <= 1 or pycor <= -1][set pcolor gray + 2] ; Jury Phase update-affect-weights update-links update-affect update-probability update-disposition ] do-plots1 do-plots2 do-plots3 do-plots4 tick print ticks end to activate-allPatches ask patches [if random 100 < 10 and pcolor != red - 3 [set pcolor orange + 1]] ; attack_rate end to deactivate-allPatches ask patches [if random 100 < 10 and pcolor != red - 3 [set pcolor yellow + random 2]] end to activate-publicPatches ask patches with [pxcor < -2 or pycor < -2] [if random 100 < 50 and pcolor != red - 3 [set pcolor orange + 1]] end to deactivate-publicPatches ask patches with [pxcor < -2 or pycor < -2] [if random 100 < 50 and pcolor != red - 3 [set pcolor yellow + random 2]] end to activate-courtroomPatches ask patches with [pxcor >= -2 and pycor >= -2] [if random 100 < 10 and pcolor != red - 3 [set pcolor orange + 1]] end to deactivate-courtroomPatches ask patches with [pxcor >= -2 and pycor >= -2] [if random 20 < 10 and pcolor != red - 3 [set pcolor yellow + random 2]] end to update-event_count ask turtles[ if pcolor = orange + 1 [set event_count event_count + 1] ] end to update-affect ask turtles [ if pcolor = orange + 1 [set affect affect + (learning_rate * (affect ^ delta) * (lambda - affect))] if pcolor != orange + 1 [set affect affect + (learning_rate * (affect ^ delta) * extinction_rate *(0 - affect))] ] end to update-probability ask turtles[ let current_probability (count patches in-radius vision with [pcolor = orange + 1]/(count patches in-radius vision)) set memory but-first memory set memory lput current_probability memory set probability mean memory ;set probability median memory ] end to update-disposition ask turtle 0 [ set disposition affect + probability + [weight] of red-link 1 0 * ([affect] of turtle 1 + [probability] of turtle 1) + [weight] of red-link 2 0 * ([affect] of turtle 2 + [probability] of turtle 2) - threshold] ask turtle 1 [ set disposition affect + probability + [weight] of red-link 0 1 * ([affect] of turtle 0 + [probability] of turtle 0) + [weight] of red-link 2 1 * ([affect] of turtle 2 + [probability] of turtle 2) - threshold] ask turtle 2 [ set disposition affect + probability + [weight] of red-link 0 2 * ([affect] of turtle 0 + [probability] of turtle 0) + [weight] of red-link 1 2 * ([affect] of turtle 1 + [probability] of turtle 1) - threshold] end to move-turtles ask turtles [ right random 360 forward 1 ] end to take-action ask turtles [ if disposition > 0 [ask patches in-radius action_radius [set pcolor red - 3]] ] end to return-as-yellow ask patches [if random 100 < 1 [set pcolor yellow + random 2]] end to setup-MyLai ask patches with [pxcor < -5 or pycor < -2 ] [set pcolor yellow + random 2] end to update-affect-weights ask red-link 2 0 [ set weight ([affect] of turtle 2 + [affect] of turtle 0)*(1 - abs ([affect] of turtle 2 - [affect] of turtle 0)) ] ask red-link 0 1 [ set weight ([affect] of turtle 0 + [affect] of turtle 1)*(1 - abs ([affect] of turtle 1 - [affect] of turtle 0)) ] ask red-link 1 2 [ set weight ([affect] of turtle 2 + [affect] of turtle 1)*(1 - abs ([affect] of turtle 2 - [affect] of turtle 1)) ] end to update-probability-weights ask red-link 2 0 [ set weight ([probability] of turtle 2 + [probability] of turtle 0)*(1 - abs ([probability] of turtle 2 - [probability] of turtle 0)) ] ask red-link 0 1 [ set weight ([probability] of turtle 0 + [probability] of turtle 1)*(1 - abs ([probability] of turtle 1 - [probability] of turtle 0)) ] ask red-link 1 2 [ set weight ([probability] of turtle 2 + [probability] of turtle 1)*(1 - abs ([probability] of turtle 2 - [probability] of turtle 1)) ] end to update-disposition-weights ask red-link 2 0 [ set weight ([disposition] of turtle 2 + [disposition] of turtle 0)*(1 - abs ([disposition] of turtle 2 - [disposition] of turtle 0)) ] ask red-link 0 1 [ set weight ([disposition] of turtle 0 + [disposition] of turtle 1)*(1 - abs ([disposition] of turtle 1 - [disposition] of turtle 0)) ] ask red-link 1 2 [ set weight ([disposition] of turtle 2 + [disposition] of turtle 1)*(1 - abs ([disposition] of turtle 2 - [probability] of turtle 1)) ] end to do-plots1 set-current-plot "Disposition" set-current-plot-pen "turtle 0" plot [disposition] of turtle 0 set-current-plot-pen "turtle 1" plot [disposition] of turtle 1 set-current-plot-pen "turtle 2" plot [disposition] of turtle 2 end to do-plots2 set-current-plot "Probability" set-current-plot-pen "turtle 0" plot [probability] of turtle 0 set-current-plot-pen "turtle 1" plot [probability] of turtle 1 set-current-plot-pen "turtle 2" plot [probability] of turtle 2 end to do-plots3 set-current-plot "Affect" set-current-plot-pen "turtle 0" plot [affect] of turtle 0 set-current-plot-pen "turtle 1" plot [affect] of turtle 1 set-current-plot-pen "turtle 2" plot [affect] of turtle 2 end to do-plots4 set-current-plot "Weights" set-current-plot-pen "red-link 2 0" plot [weight] of red-link 2 0 set-current-plot-pen "red-link 1 2" plot [weight] of red-link 1 2 set-current-plot-pen "red-link 0 1" plot [weight] of red-link 0 1 end