What my code does is to set an internal grey patch zone and an external black patch zone, where turtles can multiply (one on each patch). Once a turtle reach the boundary between the gray and the black zones I assigned the variable energy to delay the reproduction of the turtle by certain ticks ( each tick energy grows one unit). When energy reaches certain number I wanted the turtles to hatch new turtles in one of the empty black patches, but after the first generation of new turtles in the black zone i get the runtime error " MOVE-TO expected input to be an agent but got NOBODY instead."
This is my code
breed [greens a-green]
breed [reds a-red]
greens-own[energy]
to setup
clear-all
ask patch 0 0 [ ask patches in-radius 15 [set pcolor 3]]
ask n-of 20 patches with [pcolor = 3][sprout-greens 1 [set color green set energy 0]]
ask n-of 20 patches with [pcolor = 3][sprout-reds 1 [set color red]]
reset-ticks
end
to go
division
delay-expansion
expansion
tick
end
to division
ask greens[
let empty-space neighbors with [pcolor = 3 and not any? turtles-here] ;crea un set llamado "empty-space" que son los patches negros q rodean a la celula verde y q no estan ocupados
if any? empty-space [hatch 1 set color green move-to one-of empty-space] ; si existe algun patch negro alrededor, nace una celula verde y se ubica en ese patch
]
ask reds[
let empty-space neighbors with [pcolor = 3 and not any? turtles-here] ;crea un set llamado "empty-space" que son los patches negros q rodean a la celula roja y q no estan ocupados
if any? empty-space [hatch 1 set color red move-to one-of empty-space] ; si existe algun patch negro alrededor, nace una celula roja y se ubica en ese patch
]
end
to delay-expansion
ask greens[
let black-space neighbors with [pcolor = black and not any? turtles-here]
if any? black-space [set energy (energy + 1 )]
]
end
to expansion
ask greens[
let black-space neighbors with [pcolor = black and not any? turtles-here]
if energy > 5 [hatch 1 set color blue move-to one-of black-space]
]
end