Function getVectorFromCardinal

Returns an { x, y } signed vector corresponding to the provided cardinal direction.

const n = getVectorFromCardinal(`n`); // {x: 0, y: -1}

Optional multiplier can be applied to vector

const n = getVectorFromCardinal(`n`, 10); // {x: 0, y: -10}

Blank direction returns { x: 0, y: 0 }

  • Parameters

    Returns Cell

    Signed vector in the form of { x, y }