⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ---lobster2applet.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 2 页
字号:
globals [edge-patches clock ]breeds [homelobster huntlobster scent shelter]patches-own [concentration]scent-own [drop-size]to setup  ca  set-default-shape homelobster "lobster"   create-homelobster 0       ask homelobster [set size 2]    ask homelobster [set color red]    ask homelobster [set heading 0]  set-default-shape huntlobster "lobster"   create-huntlobster number       ask huntlobster [set size 2]    ask huntlobster [set color blue]  set-default-shape scent "circle"  set-default-shape shelter "square"  create-shelter 3    ask shelter [set size 4]    ask shelter [set color 35]     ask shelter [set heading (random 360) fd random screen-edge-x]  ask huntlobster [set heading (random 360) fd random screen-edge-x]     set edge-patches (patches with [abs pxcor = screen-edge-x or                                  abs pycor = screen-edge-y])  set clock 0endto go   set clock (clock + 1)  ask edge-patches    [ set concentration 0 ] ;; prevent wrapping around screen edges  scent-strategy  move-scent  ask patches [go-patches ]  ifelse clock > 50 [ask huntlobster [track-plume]]   [ask huntlobster [fd 1 bounce rt random 90 - random 90]]  plot-lobster  if (count huntlobster = 0) [stop]endto scent-strategyif strategy = "no scent" [move-scent]if strategy = "home scent"  [ask homelobster [hatch-scent 3 [set size 0.1                                   set color blue                                   set drop-size 5]]]if strategy = "time scent" [ask homelobster [hatch-scent 3 [set size 0.1                                   set color blue                                   set drop-size 5]] if clock > 50 [ask huntlobster [hatch-scent 3 [set size 0.1                                   set color blue                                   set drop-size 5]]]                                                                   ]endto move-scent   ask scent [     flow-off-screen    fd 1    drop-chem    set heading (90)       rt random (turbulence) - random (turbulence)    ] endto flow-off-screen  ;; turtle (scent) procedure  ; check: hitting left or right wall?  if (abs pxcor-of patch-ahead 1 = screen-edge-x)    ; if so, reflect heading around x axis    [ die ]  ; check: hitting top or bottom wall?  if (abs pycor-of patch-ahead 1 = screen-edge-y)    ; if so, reflect heading around y axis    [ die ]endto drop-chem  ;; turtle (scent) procedure;  if (clock > 0)  set concentration (concentration + drop-size)  set drop-size (drop-size * 0.8)endto go-patches  ;; patch procedure  set concentration (concentration * (100 - evaporation-rate) / 100)  ;;slowly evaporate chemical  update-display  ;; Refresh the Displayendto update-display  ;; patch procedureset pcolor scale-color green concentration 0.1 5  ;; scale color to show chemical concentrationendto track-plume  ;; turtle (lobster) procedure  ;; sniff left and right, and go where the strongest smell is  fd 1 bounce rt random 90 - random 90  let odor-ahead concentration-of patch-ahead 1  let odor-right concentration-of patch-right-and-ahead 45 1  let odor-left concentration-of patch-left-and-ahead 45 1if (concentration > detection-level) [if ((odor-right > odor-ahead) or (odor-left > odor-ahead))    [ ifelse (odor-right > odor-left) [ rt 45 ] [ lt 45 ]]]  if any? shelter-on neighbors [set breed homelobster set color red]endto bounce  ;; turtle (lobster) procedure  ; check: hitting left or right wall?  if (abs pxcor-of patch-ahead 1 = screen-edge-x)    ; if so, reflect heading around x axis    [ set heading (- heading) ]  ; check: hitting top or bottom wall?  if (abs pycor-of patch-ahead 1 = screen-edge-y)    ; if so, reflect heading around y axis    [ set heading (180 - heading) ]endto plot-lobsterset-current-plot "lobsters in shelter"  set-current-plot-pen "# lobsters in shelter"  plot count homelobster  end@#$#@#$#@GRAPHICS-WINDOW30310805533202012.01101110CC-WINDOW5547814642Command CenterBUTTON15107843setupsetupNIL1TOBSERVERTNILBUTTON1061216945gogoT1TOBSERVERTNILSLIDER8086252119evaporation-rateevaporation-rate01003011NILMONITOR116268111clockclock01SLIDER79120251153turbulenceturbulence01805011NILSLIDER815125384numbernumber0402011NILPLOT13304261523lobsters in shelterclock# lobsters in shelter0.040.00.010.0truefalsePENS"# lobsters in shelter" 1.0 0 -16777216 trueCHOOSER3198141243strategystrategy"home scent" "time scent" "no scent"0TEXTBOX147196297286"Home scent" is when lobsters emit scent in shelter. "Time scent" is when lobsters emit scent at a certain time. "No scent" means lobsters do not emit a scent.SLIDER78157250190detection-leveldetection-level0100.20.11NIL@#$#@#$#@WHAT IS IT?-----------This model investigates some of the factors that may be important for lobsters trying to locate a shelter.Shelters and lobsters are placed randomly across the screen during the setup.HOW IT WORKS------------Lobsters move about haphazardly for a short period (50) and then begin a search for shelter, either through a haphazard movement that brings them near a shelter or by detecting an odor emitted by lobsters occupying a shelter.  Lobsters cannot leave the screen.HOW TO USE IT-------------Shelters and lobsters are placed randomly acorss the screen during the setup.Continue hitting the setup button until the shelters are spread out (not on top of each other).You can manipulate if an attracting scent is produced when lobsters find a shelter, or if an attracting scent is released when a certain amount of time passes, or no scent is emitted.You can manipulate the number of lobsters.You can manipulate the evaporation rate such that the pheromone is long-lived (low evap)or short- lived (high evap).You can manipulate the turbulence - high turbulence spreads the pheromone; low turbulence makes the plume more linear (laminar).You can manipulate the minimum level of scent that a lobster can detect.You could even manipulate the size of the field (screen size)THINGS TO NOTICE----------------This section could give some ideas of things for the user to notice while running the model.THINGS TO TRY-------------Note how long it takes lobsters to locate a shelter when there are just a few lobsters vs when there are lots of lobsters.Note how long it takes lobsters to locate a shelter under the three strategies.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -