Tel Aviv Under Fire
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [commuters commuter] breed [explosions explosion] breed [telavivs telaviv] commuters-own [hit?] explosions-own [duration] globals [made-it hit rocket-timer attempts] to setup ca reset-ticks create-telavivs 1 [set shape "circle" set size 6 set color blue] ask telavivs [stamp] ask telavivs [die] set made-it 0 set hit 0 set rocket-timer 0 set attempts 0 create-commuters 1 [set hit? false set xcor -4 set heading 90 set shape "car" set size .2] end to go ;; move commuters commuters-move ;; hamas fires rockets rockets-landing ;; check if a rocket hits check-impact ;; advance 'age' of explosions and remove if they are over explosions-duration ;; check if commuter made it to work check-if-made-it ;; if no commuters active, make a new one if count commuters < 1[ next-commuter ;; add to total number of attempts made at crossing tel aviv set attempts attempts + 1 ] ;; stop after 100,000 attempts if attempts >= 100000 [stop] tick end to commuters-move ;; since one tick is a second, and one patch is one kilometer, we move ;; .0003 patch per tick per km/h ask commuters [fd .0003 * travel-speed] end to check-impact ask explosions[ ;; check if there are any commuters within explosion-radius distance if any? commuters with [distance myself < explosion-radius / 1000] [ ;; if there is, the commuter is hit let nearby-commuter one-of commuters with [distance myself < explosion-radius / 1000] ask nearby-commuter [ ;; add to global paramter that counts how many were hit set hit hit + 1 die] ] ] end to rockets-landing ;; add to rocket timer set rocket-timer rocket-timer + 1 if rocket-timer >= seconds-between-rockets [ ;; center explosion (has random heading), then forward radius of tel aviv (3 patches) ;; good, turtle perspective on random distribution on a circle create-explosions 1 [ ;; hide it or it gets ugly ht set shape "circle" ;; size accordingly set size explosion-radius / 1000 set color red fd random-float 3 st ;; set set duration of this explosion to global parameter value set duration explosion-duration ] ;; reset rocket timer if rocket fired set rocket-timer 0 ] end to explosions-duration ask explosions[ ;; count down and die set duration duration - 1 if duration <= 0 [die] ] end to check-if-made-it ;; this checks if commuter made it across tel aviv ask commuters with [xcor > 4.2 ] [ ;; add to global counter for people who made it set made-it made-it + 1 die] end to next-commuter ;; make a new commuter create-commuters 1 [set hit? false set xcor -4 set heading 90 set shape "car" set size .2] end
There is only one version of this model, created almost 13 years ago by Arthur Hjorth.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Tel Aviv Under Fire.png | preview | Preview for 'Tel Aviv Under Fire' | over 12 years ago, by Arthur Hjorth | Download |
This model does not have any ancestors.
This model does not have any descendants.