turtles-own[pos vel isSolid?] to setup ca let [:row screen-half-width] let [:col -1 * screen-half-width] let [:count 0] repeat 1301 [ crt 1 ask-turtle :count [setxy :col :row] let [:count :count + 1] let [:col :col + 2] if :col > screen-half-width [ let [:col :col - screen-width] let [:row :row - 1] ] ] ask-turtles [setc red setpos 0 setvel 0 setisSolid? false] ask-turtles-with [ycor = 5 and xcor > -15 and xcor < 15] [setc brown setisSolid? true] ask-turtles-with [ycor = 6 and xcor > -14 and xcor < 14] [setc brown setisSolid? true] ask-turtles-with [ycor = 7 and xcor > -15 and xcor < 15] [setc brown setisSolid? true] end to go ask-turtle 650 [setpos -100 setvel 0] ask-turtle 650 [ setc yellow ] end to sense ask-turtles-with ((not (xcor = (-1 * screen-half-width))) and (not (xcor = (screen-half-width))) and (not (ycor = (screen-half-width))) and (not (ycor = (-1 * screen-half-width))) and (not (xcor = (-1 * screen-half-width + 1))) and (not (xcor = (screen-half-width - 1))) and (not (ycor = (screen-half-width - 1 ))) and (not (ycor = (-1 * screen-half-width + 1))) ) [ go ] end