Distance Functions

How far away is one agent from another?

When finding the neighbors of agents in a simulation, HASH depends on a few important flags to produce accurate results. One such flag is the underlying distance calculations between agents in the simulation. These flags are accessible via topology configuration in properties. The topology field of your globals.json file will look something like:

"topology": {
"distance_function": "chebyshev"
"search_radius": 10


Function Name



The greatest distance between two points in any axis also known as the L-infinity norm. Wikipedia


Same as chebyshev. Named after John Conway because of its use in collecting all 8 neighbors in an agent's neighborhood.


Distance between agents are computed on a grid, where the distance is the total sum of the difference in each of the axes. Wikipedia


The point-point distance "as the crow flies" between two points Wikipedia


Same as euclidean, but the final square root is not taken. This is useful when for high-performance distance calculations when only order matters. Wikipedia

The default distance function is conway - make sure to change it depending on your use case!

Currently, HASH doesn't support multiple distance functions in a single simulation.