The two procedures to setup ca if (random 100) < density [setpc yellow] crt number setc red setxy random (screen-edge * 2) random (screen-edge * 2) end to go search-for-chip ;; find a wood chip and pick it up find-new-pile ;; find another wood chip find-empty-spot ;; find a place to put down wood chip end to search-for-chip if pc = yellow ;; if find a wood chip... [stamp black ;; remove wood chip from patch setc orange ;; turn orange while carrying chip jump 20 stop] wiggle search-for-chip end to find-new-pile if pc = yellow [stop] ;; if find a wood chip, stop wiggle find-new-pile end to find-empty-spot if pc = black ;; if find a patch without a wood chip [stamp yellow ;; put down wood chip in patch setc red ;; set own color back to red get-away stop] seth random 360 fd 1 find-empty-spot end to get-away seth random 360 jump 20 if pc = black [stop] get-away end to wiggle fd 1 rt random 50 lt random 50 end to startup ca end If there are requests I will make available an online reference manual to the Star logo language.
|