Adding methods for getting specific neighbors in square grids #1603
NicolasAmado
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
I have 2 questions:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be helpfull to add methods for SimpleGrid that gets, for example, the neighbor 1 space to "the right" (It should take into account periodic boundary conditions).
Maybe something like grid.get_single_neighbor(pos, direction, distance=1)
where direction is a string "up", "down", "left", "right" and distance is how many cells in that direction.
for example the method get_single_neighbor((x,y), "right", distance=1) would return the agent in the position (x+1,y) unless it's out of boundaries.
Beta Was this translation helpful? Give feedback.
All reactions