Closed colinhanrahan closed 2 months ago
The new logic in updateNeighbors()
looks just like cell.findNeighborAgents()
. That function is only called in doLending()
, which could just use cell.neighbors
and add a check for agent != None
like everything else. We can probably remove findNeighborAgents()
(or if you really want, change the logic of everything else to use this function).
While working on this, I overhauled agents' Von Neumann and Moore neighbors.
agent.vonNeumannNeighbors
andagent.mooreNeighbors
update*Neighbors()
functionsagent.socialNeighbors
because we still need asymmetrical adjacency neighborhoods for network overlayagent.cell.neighbors.values()
cell.neighbors
, previously a list, is now a dictionary with directions. If wraparound is turned off, cells on the edge will just not have directions that go out of bounds. For example, cells on the north edge will not have"northwest"
,"north"
, or"northeast"
in theircell.neighbors
dictionary.Possible changes:
cell.neighbors
uses whichever neighborhood mode you picked in the config.