<commit_before>import { TaggedPlant } from "../../map/interfaces";
import { PlantGridData } from "./constants";
import { range } from "lodash";

export function vectorGrid(params: PlantGridData): [number, number][] {
  const rows = range(params.startX,
    params.startX + (params.numPlantsH * params.spacingH),
    params.spacingH);

  const cols = range(params.startY,
    params.startY + (params.numPlantsV * params.spacingV),
    params.spacingV);

  const results: [number, number][] = [];

  rows.map(x => cols.map(y => results.push([x, y])));

  return results;
}

export function initPlantGrid(_params: PlantGridData): TaggedPlant[] {
  const output: TaggedPlant[] = [];
  return output;
}<commit_msg>initPlantGrid() is ready for use.<commit_after>import { PlantGridData } from "./constants";
import { range } from "lodash";
import { uuid } from "farmbot";
import { PlantPointer } from "farmbot/dist/resources/api_resources";

export function vectorGrid(params: PlantGridData): [number, number][] {
  const rows = range(params.startX,
    params.startX + (params.numPlantsH * params.spacingH),
    params.spacingH);

  const cols = range(params.startY,
    params.startY + (params.numPlantsV * params.spacingV),
    params.spacingV);

  const results: [number, number][] = [];

  rows.map(x => cols.map(y => results.push([x, y])));

  return results;
}

const createPlant = (p: PlantGridData, openfarm_slug: string, gridId: string) =>
  (vec: [number, number]): PlantPointer => {
    const [x, y] = vec;
    return {
      name: `${openfarm_slug} ${p.numPlantsH}x${p.numPlantsV}`,
      radius: 0,
      z: 0,
      x,
      y,
      openfarm_slug,
      pointer_type: "Plant",
      plant_stage: "planted",
      meta: { gridId }
    };
  };

export function initPlantGrid(p: PlantGridData, openfarm_slug: string): PlantPointer[] {
  const gridId = uuid();
  const mapper = createPlant(p, openfarm_slug, gridId);
  return vectorGrid(p).map(mapper);
}
{'fraction_non_alphanumeric': 0.15364982133741706, 'fraction_numerical': 0.0010209290454313426, 'mean_word_length': 3.9494949494949494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4621374', 'n_tokens_mistral': 677, 'n_tokens_neox': 665, 'n_words': 152}