Function get_surroundings

  • Returns the surrounding positions. Diagonals are optional.

    Parameters

    • x: number

      the x reference position.

    • y: number

      the y reference position.

    • with_diagonals: boolean = false

      if true, includes diagonals.

    • shift: number = 1

      how distant if the surrounding positions from the given position.

    Returns {
        diag: boolean;
        direction: directions;
        x: number;
        y: number;
    }[]

    Returns the surrounding positions.