BehaviourComposer: ignore everything before this. Begin micro-behaviour: Begin description:
End description move to task Begin NetLogo code: substitute-text-area-for a-task "dig" substitute-text-area-for a-sub-task "walk across village" substitute-text-area-for cond-t any? ( all-of-kind "start of path" ) in-radius my-vision substitute-text-area-for a-target one-of ( all-of-kind "start of path" ) in-radius my-vision substitute-text-area-for b-target min-one-of all-of-kind "start of path" [ distance myself ] substitute-text-area-for visualize-action-code face current-target rt ( 15 - random 30 ) fd my-walk substitute-text-area-for n-task "dig" substitute-text-area-for n-sub-task "walk along path" let current-task a-task let current-sub-task a-sub-task let current-target 0 ifelse cond-t [ set current-target a-target ] [ set current-target b-target ] let next-task n-task let next-sub-task n-sub-task ;; Initialize an intention (to do an activity) in a farmer if first my-task = current-task and my-sub-task = current-sub-task [ if my-target = 0 [ set my-target current-target ] ] ;; Act on current intention (to do an activity) if length my-task != 0 and first my-task = current-task and my-sub-task = current-sub-task [ visualize-action-code ;; when reach target initialize for next sub-task if distance my-target <= my-vision [ move-to my-target set my-task replace-item 0 my-task next-task set my-sub-task next-sub-task set my-target 0 ] ] End NetLogo code BehaviourComposer: ignore everything after this. |