mwg API
    Preparing search index...

    Function chebyshev

    • Chebyshev ruler distance between two cells: the king-move count, a diagonal costing one step.

      The counterpart to euclidean above for grid movement and range, where a diagonal is a single step rather than 1.41 cells; roguelike chebyshevDistance is this same arithmetic through its own Step type.

      Parameters

      • a: { x: number; y: number }
      • b: { x: number; y: number }

      Returns number

      import { chebyshev } from '@datamoc/mwg/core';

      chebyshev({ x: 0, y: 0 }, { x: 3, y: 4 }); // 4