code: function getAllNearPositions(position) {
      return [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1] // Below positions
      ].map(function (toAdd) {
          return {
              x: position.x + toAdd[0],
              y: position.y + toAdd[1]
          };
      });
  }
docs: Get all valid and invalid near positions.