I am making a predator-prey model, following the wolf-sheep example using Agents.jl
.
Following on from this question, instead of sheep moving to a random cell I am trying to make the sheep move to a cell that contains grass.
I can get all cells around a sheep with the following:
near_cells = nearby_positions(sheep.pos, model, 1)
I then want to subset those cells to only get the ones that contain grass e.g. this is pseudo code of what I want to do (doesn’t work):
cell_w_grass = near_cells[near_cells.fully_grown == true]
I am struggling with the above step, I cannot figure out how to subset the object near_cells
I am having difficulty understanding the data structure which looks like this: Base.Iterators.Filter{Agents.var"#74#76"{Matrix{Vector{Int64}}} ...
Again, probably an obvious question that I am missing due to being a Julia/Agents novice, any advice would be greatly appreciated!