Godzilla
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This section could give a general understanding of what the model is trying to show or explain.
HOW IT WORKS
This section could explain what rules the agents use to create the overall behavior of the model.
HOW TO USE IT
This section could explain how to use the model, including a description of each of the items in the interface tab.
THINGS TO NOTICE
This section could give some ideas of things for the user to notice while running the model.
THINGS TO TRY
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
EXTENDING THE MODEL
This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
NETLOGO FEATURES
This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
RELATED MODELS
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
CREDITS AND REFERENCES
This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
Comments and Questions
extensions [gogo] extensions [sound] globals [ serial-port ;; different on different operating systems deathcount ] to setup set serial-port user-one-of "Select a port:" gogo:ports gogo:open serial-port repeat 5 [ if not gogo:ping [ user-message "The GoGo Board is not responding." ] ] gogo:talk-to-output-ports [ "a" "b" "c" "d" ] end to gogo-ping carefully [ if not gogo:ping [ user-message "Unable to ping GoGo Board." ] ] [ user-message error-message ] end breed [monsters monster] breed [people person] ;globals [deathcount] ;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setup Procedures ;;; ;;;;;;;;;;;;;;;;;;;;;;;; ;; this procedure moves godzilla to go every 0.1 [ move-godzilla move-peeps] update-plot end ;; draw the map and create godzilla to startup setup clear-all set-default-shape monsters "godzilla" set-default-shape people "person" draw-map create-peeps create-godzilla end to update-plot set-current-plot "deathcount" set-current-plot-pen "deaths" plot deathcount end ;; This will color the patches to make the roads to draw-map ask patches [ set pcolor gray ] ;[ set pcolor scale-color gray ((random 500) + 5000) 0 9000 ] ask patches with [pxcor = -14] [set pcolor black] ask patches with [pxcor = -13] [set pcolor black] ask patches with [pxcor = -12] [set pcolor black] ask patches with [pxcor = -6] [set pcolor black] ask patches with [pxcor = -5] [set pcolor black] ask patches with [pxcor = -4] [set pcolor black] ;; ask patches with [pxcor = 2] [set pcolor black] ask patches with [pxcor = 3] [set pcolor black] ask patches with [pxcor = 4] [set pcolor black] ask patches with [pxcor = 10] [set pcolor black] ask patches with [pxcor = 11] [set pcolor black] ask patches with [pxcor = 12] [set pcolor black] ;; ask patches with [pycor = -14] [set pcolor black] ask patches with [pycor = -13] [set pcolor black] ask patches with [pycor = -12] [set pcolor black] ask patches with [pycor = -6] [set pcolor black] ask patches with [pycor = -5] [set pcolor black] ask patches with [pycor = -4] [set pcolor black] ;; ask patches with [pycor = 2] [set pcolor black] ask patches with [pycor = 3] [set pcolor black] ask patches with [pycor = 4] [set pcolor black] ask patches with [pycor = 10] [set pcolor black] ask patches with [pycor = 11] [set pcolor black] ask patches with [pycor = 12] [set pcolor black] end ;; create a new godzilla, starts in upper right hand corner to create-godzilla ask patches with [pxcor = -13 and pycor = 13] [ sprout-monsters 1 [ set color green set size 4 ]] end ;; moves godzilla one step in a random direction supplied by ;; clear-headings to move-godzilla ;; Observer Procedure ask monsters [ ; if sensor1 < 1023, move forward one step if gogo:sensor 1 < 1000 [ fd 1 ;sound:play-note "Breath Noise" 60 64 2 if random 5 = 1 [sound:play-sound "zilla4.wav"] ask neighbors4 [ set pcolor black ] ] ; if sensor2 > 400, move right one step ifelse gogo:sensor 4 > 500 [ set heading 90 ] ; else if sensor2 < 200, move left one step [ if gogo:sensor 4 < 275 [ set heading 180 ] ] ] end ;; clear-headings returns a list of directions that ;; Godzilla can turn. Godzilla turns towards directions based ;; on the road and based on which parts of the buildings he has ;; already destroyed. to-report clear-headings ;; Godzilla procedure let dirs [] if [pcolor] of patch-at 0 1 = black [ set dirs lput 0 dirs ] if [pcolor] of patch-at 1 0 = black [ set dirs lput 90 dirs ] if [pcolor] of patch-at 0 -1 = black [ set dirs lput 180 dirs ] if [pcolor] of patch-at -1 0 = black [ set dirs lput 270 dirs ] report dirs end ;;people creation to create-peeps ask patches with [pcolor = black] [ if numpeople > random 10 [sprout-people 1 [ set color blue set size 1 ]]] end ;;people commands to move-peeps ask people [ ;;if the monster is on any of the surrounding 8 spaces if count monsters-on neighbors > 0 ;;set my color to red [ set color red ] ;;if my color is red if color = red ;;make me run around like an idiot [set heading one-of clear-headings fd 1] ;;if I am next to a red person if any? (people-on neighbors) with [ color = red ] ;;make me run away [ set heading one-of clear-headings fd 1 ] ;;if I happen to share a space with another person (trample) if count people-here > 1 ;;kill me and add to the deathcount [set deathcount deathcount + 1 die] ] end
There is only one version of this model, created about 15 years ago by Amy Wong.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.