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

📄 jonnywalker-3.6.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 5 页
字号:
      set od 4]]      if destination = "Sky" [ask johnnywalker[      set od 5]]      if destination = "Green" [ask johnnywalker[            set od 6]]      if destination = "Red" [ask johnnywalker[            set od 7 ]]      if destination = "Orange" [ask johnnywalker[         set od 8]]      ask johnnywalker[      set-initial-heading-color      set playtime 2400]      end        to  set-initial-heading-color  if od = 1 [set initial-heading towardsxy-nowrap (-38 + random 7)  (32)    set color blue]  if od = 2 [set initial-heading towardsxy-nowrap (-1 + random 4)  (32 + random 4)   set color yellow]  if od = 3 [set initial-heading towardsxy-nowrap (30) (31 + random 7)   set color violet]  if od = 4 [ set initial-heading towardsxy-nowrap (-25 + random 4)  (5 + random 4)   set color brown]  if od = 5 [set initial-heading towardsxy-nowrap (22 + random 4) (11 + random 4)   set color sky]  if od = 6 [set initial-heading towardsxy-nowrap (-21 + random 4)  (-3 + random 4)   set color green ]  if od = 7 [set initial-heading towardsxy-nowrap (-2 + random 4) (-3 + random 4)   set color red]  if od = 8 [ set initial-heading towardsxy-nowrap (-28 + random 4) (-27 + random 4)   set color orange]  if od = 9 [set initial-heading towardsxy-nowrap (-49 + (random 100)) (-49 + (random 100))   set color pink]   if od = 11 [set initial-heading towardsxy-nowrap (43) (-17 - random 2) set color 109]   if od = 12 [set initial-heading towardsxy-nowrap (43) (-29) set color 109]   if od = 13 [set initial-heading towardsxy-nowrap -9 12 set color 109]   if od = 14 [set initial-heading towardsxy-nowrap -5 4 set color 109]  end;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GO!!!!!! to go  set clock clock + 1  set total-johnnywalker count johnnywalker  if kind-of-walker = "Explorer"[  ask johnnywalker [if ccc > 0 [set ccc ccc - 1]]  draw-plot  if(clock > 1 and (clock mod 20) = 1)[setup-explorer]]  ask johnnywalker at-points[[43 -17][43 -18][43 -29][-9 12][-5 4]][set-o-num]  go-johnnywalker  leave  report-walkability  setup-count  if ((clock mod 2400) = 0)[stop]  end  to intial-o-num      set  o-b-num  1      set  o-y-num  1      set  o-v-num  1      set  o-br-num  1      set  o-s-num  1      set  o-g-num  1      set  o-r-num  1      set  o-o-num  1  end  to set-o-num   if od = 1[set o-b-num o-b-num + 1]  if od = 2[set o-y-num o-y-num + 1]  if od = 3[set o-v-num o-v-num + 1]  if od = 4[set o-br-num o-br-num + 1]  if od = 5[set o-s-num o-s-num + 1]  if od = 6[set o-g-num o-g-num + 1]  if od = 7[set o-r-num o-r-num + 1]  if od = 8[set o-o-num o-o-num + 1]  end    to go-johnnywalker   ask johnnywalker[if (pcolor != color)[   set staytime 0   odinfo   turn-towards-diamdegree   move]   ]   ask johnnywalker[if (pcolor = color)[stay]   ]   ask johnnywalker[set playtime playtime - 1]   end   to stayset j-walkability 0if playtime > 300[if staytime = 0[if od = 2[set d-y-num d-y-num + 1]if od = 3[set d-v-num d-v-num + 1]if od = 4[set d-br-num d-br-num + 1]if od = 5[set d-s-num d-s-num + 1]if od = 6[set d-g-num d-g-num + 1]if od = 7[set d-r-num d-r-num + 1]]if pcolor = blue [set d-b-num d-b-num + 1 die]if pcolor = orange [set d-o-num d-o-num + 1 die]if pcolor = red[set max-staytime 600  set staytime (staytime + 1 + random 2)]if pcolor = yellow[set max-staytime 600  set staytime (staytime + 1 + random 2)]if pcolor = sky[set max-staytime 600  set staytime (staytime + 1 + random 2)]if pcolor = green[set max-staytime 600  set staytime (staytime + 1 + random 2)]if pcolor = violet[set max-staytime 200  set staytime (staytime + 1)]if pcolor = brown[set max-staytime 100  set staytime (staytime + 1)]if staytime > max-staytime[set od ((random 9)+ 1) set-initial-heading-colorset-o-numset j-walkability 10]]end  to odinfo   if od = 1 and (isoarea > x ) [     set current-heading towardsxy-nowrap (-38 + random 7)  (32)]   if od = 2 and (isoarea > x ) [     set current-heading towardsxy-nowrap(-1 + random 4)  (32 + random 4)]     if od = 3 and (isoarea > x ) [     set current-heading towardsxy-nowrap (30) (31 + random 7)]   if od = 4 and (isoarea > x ) [     set current-heading towardsxy-nowrap (-25 + random 4)  (5 + random 4)]     if od = 5 and (isoarea > x ) [     set current-heading towardsxy-nowrap (22 + random 4) (11 + random 4)]   if od = 6 and (isoarea > x ) [     set current-heading towardsxy-nowrap (-21 + random 4)  (-3 + random 4)]   if od = 7 and (isoarea > x ) [     set current-heading towardsxy-nowrap (-2 + random 4) (-3 + random 4)]     if od = 8 and (isoarea > x ) [     set current-heading towardsxy-nowrap (-28 + random 4) (-27 + random 4)]       if od = 11 and (isoarea > x )[    set current-heading towardsxy-nowrap (43) (-17 - random 2)]    if od = 12 and (isoarea > x )[    set current-heading towardsxy-nowrap (43) (-29)]    if od = 13 and (isoarea > x )[    set current-heading towardsxy-nowrap -9 12]    if od = 14 and (isoarea > x )[    set current-heading towardsxy-nowrap -5 4]      end   to turn-towards-diamdegree  locals[best-direction best-diamdegree final-direction best-att diff-45 diff+45 walkability-0 walkability-45 walkability+45]  if ((clock mod mod-time)= 0)[set current-heading initial-heading]

⌨️ 快捷键说明

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