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

📄 ---rgw.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 2 页
字号:
globals [field stappen lijst]turtles-own [ energy age]breeds [rabbits]to setup  ca  grow-grass-and-weeds  set-default-shape rabbits "rabbit"  create-custom-rabbits number [    set color white    randomize-position    set age 0    set energy random 10  ;start with a random amt. of energy  ]  setup-plot  do-plot  set field (count patches) endto go just-add ;refill ;grow-grass-and-weeds move  do-plot if not any? turtles [ stop ]endto testlocals [gras onkruid]caset field (count patches)set lijst []set gras []set onkruid []repeat 10 [  set stappen 0  while [((count (patches with [pcolor = black])) / field) > 0.1]               [ ;refill                just-add                ;grow-grass-and-weeds                 set stappen (stappen + 1)]  show stappen  set lijst (fput stappen lijst)  set gras (fput (count patches with [pcolor = green ]) gras)  set onkruid (fput (count patches with [pcolor = violet]) onkruid)   cp ] show mean lijst show gras show onkruidendto een-testlocals [g v]set g []set v []repeat 50 [    cp  ;refill  ;just-add  grow-grass-and-weeds  set g (fput (count patches with [pcolor = green ]) g)  set v (fput (count patches with [pcolor = violet]) v)   ]show word "grass: " (mean g)show word "weed: " (mean v)endto move  ask rabbits   [ step    eat-grass    eat-weeds    set age (age + 1)    reproduce    death     ]end;ondanks dat het gras over de weeds heen groeit, is bij 90% begroeing de ;verdeling tussen gras en onkruid 1-1; en ook hier duurt het +- 76 tellen; bij een leeg veld wordt er bijna 15 en iets meer dan 14 van resp gras & weeds toegevoegdto grow-grass-and-weeds  ask patches [    if pcolor = black [      if ( random-float 1000 ) < weeds-grow-rate        [ set pcolor violet ]      if ( random-float 1000 ) < grass-grow-rate        [ set pcolor green ]  ]   ]end; refill levert een 1-1 verdeling op van grass en weeds. het veld raakt vol in ongeveer 76 tellen; bij een leeg veld wordt er inderdaad 16 en 13,5 van resp gras & weeds toegevoegdto refill  ask patches [     if ( random-float 1000 ) < weeds-grow-rate        [ set pcolor violet ]      if ( random-float 1000 ) < grass-grow-rate        [ set pcolor green ]  ] end;zoalng de refill kleiner is dan 1/10e gaat het goedto just-addlocals [n]set n (count patches with [pcolor = black])ifelse n > 28  [    ask random-n-of 15 (patches with [pcolor = black]) [set pcolor green]    ask random-n-of 13 (patches with [pcolor = black]) [set pcolor violet]  ]  [ask random-n-of round (n * (15 / 28)) (patches with [pcolor = black]) [set pcolor green]   ask random-n-of round (n * (13 / 28)) (patches with [pcolor = black]) [set pcolor violet]   ]endto step   ;moving takes some energy  rt random-float 50  lt random-float 50  fd 1  set energy ( energy - 0.5 )endto eat-grass       ;;gain "grass-energy" by eating grass  if ( pcolor = green )  [ stamp black    set energy ( energy + grass-energy ) ]endto eat-weeds     ;;gain "weed-energy" by eating weeds  if ( pcolor = violet )  [ stamp black    set energy ( energy + weed-energy )]endto reproduce     ;;give birth to a new rabbit, but it takes lots of energy  if ( energy > birth-threshold )    [ set energy ( energy / 2 )      hatch 1 [ fd 1 set age 0] ]endto death     ;;die if you run out of energy  if ( energy < 0 )    [ plot-age age die ]endto plot-age [n]set-current-plot "age"set-current-plot-pen "age"plot nendto do-plot  set-current-plot "Populations"  set-current-plot-pen "grass"  plot ( count patches with [pcolor = green] )  set-current-plot-pen "rabbits"  plot count turtles  set-current-plot-pen "weeds"  plot ( count patches with [pcolor = violet] )endto randomize-position  setxy random-float screen-size-x        random-float screen-size-yendto setup-plot ;; set up plotting  set-current-plot "Populations"  set-plot-y-range 0 numberend; *** NetLogo Model Copyright Notice ***;; This model was created as part of the project:; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN; CLASSROOMS.  The project gratefully acknowledges the support of the; National Science Foundation (REPP program) -- grant number REC #9814682.;; Copyright 2001 by Uri Wilensky.  Updated 2002.  All rights reserved.;; Permission to use, modify or redistribute this model is hereby granted,; provided that both of the following requirements are followed:; a) this copyright notice is included.; b) this model will not be redistributed for profit without permission;    from Uri Wilensky.; Contact Uri Wilensky for appropriate licenses for redistribution for; profit.;; To refer to this model in academic publications, please use:; Wilensky, U. (2001).  NetLogo Rabbits Grass Weeds model.; http://ccl.northwestern.edu/netlogo/models/RabbitsGrassWeeds.; Center for Connected Learning and Computer-Based Modeling,; Northwestern University, Evanston, IL.;; In other publications, please use:; Copyright 1998 by Uri Wilensky.  All rights reserved.  See; http://ccl.northwestern.edu/netlogo/models/RabbitsGrassWeeds; for terms of use.;; *** End of NetLogo Model Copyright Notice ***@#$#@#$#@GRAPHICS-WINDOW29613740478151514.01101110CC-WINDOW5525749620Command CenterBUTTON22267759setupsetupNIL1TOBSERVERTNILBUTTON872614259gogoT1TOBSERVERTNILSLIDER3108141141grass-grow-rategrass-grow-rate0.020.020.01.01NILSLIDER3141150174weeds-grow-rateweeds-grow-rate0.020.020.01.01NILSLIDER143108274141grass-energygrass-energy0.010.05.00.51NILSLIDER152141274174weed-energyweed-energy0.010.05.00.51NILSLIDER376112109numbernumber0.0500.090.01.01NILSLIDER11476274109birth-thresholdbirth-threshold0.020.015.01.01NILPLOT3176274372PopulationsTimePop0.0100.00.0111.0truetruePENS"grass" 1.0 0 -11352576 true"rabbits" 1.0 0 -65536 true"weeds" 1.0 0 -8716033 trueMONITOR51385140434count rabbitscount rabbits11BUTTON1492521258NILtestNIL1TOBSERVERT

⌨️ 快捷键说明

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