📄 jonnywalker-3.6.nlogo
字号:
set heading current-heading set best-direction current-heading set best-diamdegree diamdegree-ahead set walkability-0 walkability-ahead set heading current-heading - 45 set walkability-45 walkability-ahead set diff-45 (diamdegree-ahead - best-diamdegree) if walkability-45 < 80[ if diff-45 > 0 [set best-direction current-heading - 45 set best-diamdegree diamdegree-ahead] if diff-45 = 0 and walkability-0 < 80 [set best-direction current-heading + random-one-of[-45 0]] if diff-45 = 0 and walkability-0 > 80 [set best-direction current-heading - 45 set best-diamdegree diamdegree-ahead] ] set heading current-heading + 45 set walkability+45 walkability-ahead set diff+45 (diamdegree-ahead - best-diamdegree) if walkability+45 < 80[ if diff+45 > 0 [set best-direction current-heading + 45] if diff+45 = 0 and diff-45 = 0 and walkability-0 < 80 and walkability-45 < 80 [set best-direction current-heading + random-one-of[45 0 -45]] if diff+45 = 0 and diff-45 = 0 and walkability-0 > 80 and walkability-45 < 80 [set best-direction current-heading + random-one-of[45 -45]] if diff+45 = 0 and diff-45 = 0 and walkability-0 < 80 and walkability-45 > 80 [set best-direction current-heading + random-one-of[45 0]] if diff+45 = 0 and diff-45 > 0 and walkability-45 < 80 [set best-direction current-heading + random-one-of[45 -45]] if diff+45 = 0 and diff-45 > 0 and walkability-45 > 80 [set best-direction current-heading + 45] if diff+45 = 0 and diff-45 < 0 and walkability-0 < 80 [set best-direction current-heading + random-one-of[45 0]] if diff+45 = 0 and diff-45 < 0 and walkability-0 > 80 [set best-direction current-heading + 45] ] set heading best-direction set current-heading best-direction if (od = 1 )and (att1-ahead > 0)[ set final-direction current-heading set best-att att1-ahead set heading current-heading - 45 if(att1-ahead > best-att) [set final-direction current-heading - 45 set best-att att1-ahead] set heading current-heading + 45 if(att1-ahead > best-att) [set final-direction current-heading + 45 set best-att att1-ahead] set heading final-direction set current-heading final-direction ] if (od = 2 )and (att2-ahead > 0)[ set final-direction current-heading set best-att att2-ahead set heading current-heading - 45 if(att2-ahead > best-att) [set final-direction current-heading - 45 set best-att att2-ahead] set heading current-heading + 45 if(att2-ahead > best-att) [set final-direction current-heading + 45 set best-att att2-ahead] set heading final-direction set current-heading final-direction ] if (od = 3 )and (att3-ahead > 0)[ set final-direction current-heading set best-att att3-ahead set heading current-heading - 45 if(att3-ahead > best-att) [set final-direction current-heading - 45 set best-att att3-ahead] set heading current-heading + 45 if(att3-ahead > best-att) [set final-direction current-heading + 45 set best-att att3-ahead] set heading final-direction set current-heading final-direction ] if (od = 4 )and (att4-ahead > 0)[ set final-direction current-heading set best-att att4-ahead set heading current-heading - 45 if(att4-ahead > best-att) [set final-direction current-heading - 45 set best-att att4-ahead] set heading current-heading + 45 if(att4-ahead > best-att) [set final-direction current-heading + 45 set best-att att4-ahead] set heading final-direction set current-heading final-direction ] if (od = 5 )and (att5-ahead > 0)[ set final-direction current-heading set best-att att5-ahead set heading current-heading - 45 if(att5-ahead > best-att) [set final-direction current-heading - 45 set best-att att5-ahead] set heading current-heading + 45 if(att5-ahead > best-att) [set final-direction current-heading + 45 set best-att att5-ahead] set heading final-direction set current-heading final-direction ] if (od = 6 )and (att6-ahead > 0)[ set final-direction current-heading set best-att att6-ahead set heading current-heading - 45 if(att6-ahead > best-att) [set final-direction current-heading - 45 set best-att att6-ahead] set heading current-heading + 45 if(att6-ahead > best-att) [set final-direction current-heading + 45 set best-att att6-ahead] set heading final-direction set current-heading final-direction ] if (od = 7 )and (att7-ahead > 0)[ set final-direction current-heading set best-att att7-ahead set heading current-heading - 45 if(att7-ahead > best-att) [set final-direction current-heading - 45 set best-att att7-ahead] set heading current-heading + 45 if(att7-ahead > best-att) [set final-direction current-heading + 45 set best-att att7-ahead] set heading final-direction set current-heading final-direction ] if (od = 8)and (att8-ahead > 0)[ set final-direction current-heading set best-att att8-ahead set heading current-heading - 45 if(att8-ahead > best-att) [set final-direction current-heading - 45 set best-att att8-ahead]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -