I am trying to create a rate of movement model for a turtle to an adjacent patch. Ultimately I want the turtle, given a certain condition, to hatch 8 potential other turtles each to travel specifically to one of their neighbors based on their direction. Basically I want to specify the neighbor patches as North-neighbor, South-neighbor, East neighbor, West neighbor, NW neighbor, and so on. From then I want to have each turtle created to move to a specific patch. Each patch variable has 8 rates of movement: rate to move north, rate to move south, and so on. So I want those 8 turtles to move to their specific patch at the rate of their neighbor patch. After it reaches the center of its North neighbor, I want the North neighbor variable to reset so that the new North neighbor is the North neighbor of the old North neighbor. Here is a code example of just specifying the North-neighbor (I plan on having separate procedures for North-neighbor, South-neighbor, etc.
patches-own[I-b-N heat-sink-N ROM-N ROM-S]
to setup[
ca
reset-ticks
crt 1 [
set shape "triangle"
set color red
]
ask patches[
set pcolor green
set ROM-N 5
set ROM-S 6 ;here there would be ROS-N ROS-S ROS-E ... for each patch
set I-b-N 8
set heat-sink-N 2
]
]
to go
spread-north
;spread-south
tick
end
to spread-north ;duplicate and modify the same procedure for south, east, west,...
ask turtles [
if xcor = [pxcor] of patch-here and ycor = [pycor] of patch-here[
set N-neighbor [patch-at-heading-and-distance 0 1] of self]
]
ask turtles[ ;I use two ask turtles to make sure N-neighbor is created at the beginning of the procedure
let goal N-neighbor ;here to store N-neighbor
let parent patch-here
if [I-b-N] of parent > [heat-sink-N] of goal[ ;If my patch's North-facing I-b > North heat-sink of North neighbor
hatch 1 [
face goal ;make sure it is facing towards North neighbor
while [xcor != [pxcor] of goal and ycor != [pycor] of goal][
fd 1 / ((ROM-N + [ROM-N] of goal) / 2) ;moves forward a fraction of the distance between patch-here and North neighbor until it has reached the center coordinates of North neighbor
]
set pcolor black
]
end