Distance typedef

Distance = int Function(Pos a, Pos b)

A function that returns an integer distance between two positions.

Each function, unless otherwise specified, should:

  • Return a non-negative integer and 0 only if bothpositions are the same.
  • Be commutative, i.e. f(a, b) == f(b, a).
  • Be reflexive, i.e. f(a, a) == 0.

Implementation

typedef Distance = int Function(Pos a, Pos b);