Skip to content

Utils: math

Vector and math utilities used by pathfinding / movement heuristics.

argmax(x)

Return index of maximum value in list x (first in tie).

position_to_vector(position)

Convert a Position dataclass to a vector of its field values.

vector_dot_product(vec1, vec2)

Return dot product of two equal-length integer vectors.

vector_subtract(vec1, vec2)

Return vec1 - vec2 element-wise for equal-length vectors.