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

📄 ---daisyworld.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 2 页
字号:
;    This program is free software; you can redistribute it and/or modify;    it under the terms of the GNU General Public License as published by;    the Free Software Foundation; either version 2 of the License, or;    (at your option) any later version.;    This program is distributed in the hope that it will be useful,;    but WITHOUT ANY WARRANTY; without even the implied warranty of;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;    GNU General Public License for more details.;    You should have received a copy of the GNU General Public License;    along with this program; if not, write to the Free Software;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307patches-own [  temperature  albedo  white?  black?  free?  ]  globals [  time  global-temperature  num-blacks  num-whites  scenario-phase  ]  to setup clear-all ask patches [   set pcolor grey   set free? true   set black? false   set white? false   set albedo albedo-of-empty   ]    set global-temperature 0 set time 0   if (scenario? = true) [     set scenario-phase 1     set solar-luminosity 0.6     ] repeat (start-number-blacks) [   seed-black-randomly   ] repeat (start-number-whites) [   seed-white-randomly   ] ask patches [   calc-temperature   update-display    ]      set global-temperature (mean values-from patches [temperature])   set num-whites start-number-whites   set num-blacks start-number-blacks   endto go  if (scenario? = true) [      if (scenario-phase = 2) [          set solar-luminosity (solar-luminosity - scenario-incrementor)          if (solar-luminosity <= 0.3) [              set scenario-phase 1              stop go              ]          ]      if (scenario-phase = 1) [          set solar-luminosity (solar-luminosity + scenario-incrementor)          if (solar-luminosity >= 2.3) [              set scenario-phase 2              ]          ]      ]  diffuse temperature 1  repeat (seed-number-blacks) [seed-black-randomly]  repeat (seed-number-whites) [seed-white-randomly]    ask patches [    without-interruption [       check-biology       ]    ]  ask patches [         calc-temperature    update-display  ]  set global-temperature (mean values-from patches [temperature])      set-current-plot "global temperature"  plot global-temperature    set-current-plot "luminosity"  plot solar-luminosity    set num-whites count patches with [white? = true]  set num-blacks count patches with [black? = true]    set-current-plot "Population"  set-current-plot-pen "Black"  plot num-blacks  set-current-plot-pen "White"  plot num-whites     set time (time + 1)endto seed-black-randomly locals [x y counter]  set counter 0  ; setup a white daisy at a random empty position loop [ set counter counter + 1 set x ((random-int-or-float screen-size-x) - screen-edge-x) set y ((random-int-or-float screen-size-y) - screen-edge-y) if ((free?-of patch-at x y) = true) [   set free?-of patch-at x y  false   set black?-of patch-at x y true   set white?-of patch-at x y false   set albedo-of patch-at x y albedo-of-blacks   stop   ] if counter > 3 [stop]   ]     endto seed-white-randomly locals [x y counter]  set counter 0 ; setup a white daisy at a random empty position loop [ set counter counter + 1 set x ((random-int-or-float screen-size-x) - screen-edge-x) set y ((random-int-or-float screen-size-y) - screen-edge-y) if ((free?-of patch-at x y) = true) [   set free?-of patch-at x y  false   set black?-of patch-at x y false   set white?-of patch-at x y true   set albedo-of patch-at x y albedo-of-whites   stop   ]  if counter > 3 [stop]     ]     endto check-biology locals [seed-threshold empty-space seeding-place]  if (free? = false) [    if ((random-int-or-float 1.0) < daisy-decay-rate) [       set free? true       set white? false       set black? false       set albedo albedo-of-empty       ]    set seed-threshold ((0.1457 * temperature) - (0.0032 * (temperature ^ 2)) - (0.6443))    if ((random-int-or-float 1.0) < seed-threshold) [       set empty-space neighbors with [(free? = true)]       set seeding-place random-one-of empty-space       if (seeding-place != nobody) [           if (white? = true) [              ask seeding-place [                  set free? false                  set white? true                  set black? false                  set albedo albedo-of-whites                  ]               ]           if (black? = true) [              ask seeding-place [                  set free? false                  set white? false                  set black? true                  set albedo albedo-of-blacks                  ]               ]                          ]      ]   ]endto calc-temperature locals [absorbed-luminosity local-heating] set absorbed-luminosity ((1 - albedo) * solar-luminosity) set local-heating 72.362 * LN(absorbed-luminosity) + 79.852 set temperature ((temperature + local-heating) / 2)    endto update-display ifelse (draw-temp-map? = true) [   set pcolor scale-color red temperature -50 110   ]   [   ifelse (free? = true) [set pcolor grey]       [       ifelse (black? = true)             [set pcolor black]                  [set pcolor white]              ]   ]end@#$#@#$#@GRAPHICS-WINDOW2361494545047277.36010111CC-WINDOW11613224674Command CenterBUTTON149381221420NILsetupNIL1TOBSERVERTBUTTON164422223461NILgoT1TOBSERVERTSLIDER16160221193albedo-of-whitesalbedo-of-whites010.750.011NILSLIDER15198220231albedo-of-blacksalbedo-of-blacks010.250.011NILSLIDER17122221155albedo-of-emptyalbedo-of-empty010.50.011NILSLIDER14236220269start-number-blacksstart-number-blacks0100511NILSLIDER14272220305start-number-whitesstart-number-whites0100511NILSLIDER14308220341seed-number-blacksseed-number-blacks0100111NILSLIDER14343220376seed-number-whitesseed-number-whites0100111NILSWITCH15427158460draw-temp-map?draw-temp-map?11-1000MONITOR89510223559NILglobal-temperature31SLIDER1942

⌨️ 快捷键说明

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