{
  "definitions": [
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "domain/converters/learning.fragment.converter.ts",
          "name": "orthogonal",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-fragment-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.fragment.converter.ts",
            "label": "domain/converters/learning.fragment.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.fragment.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-fragment-converter-ts"
          }
        },
        {
          "file": "domain/converters/learning.fragment.converter.ts",
          "name": "orthogonal",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-fragment-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.fragment.converter.ts",
            "label": "domain/converters/learning.fragment.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.fragment.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-fragment-converter-ts"
          }
        }
      ],
      "exported": true,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 40,
      "name": "isSolid",
      "signature": "export const isSolid = function isSolid(grid: LearningGrid, point: LearningPoint): boolean {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "domain/converters/learning.grid.converter.ts",
          "name": "neighbors",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-grid-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.grid.converter.ts",
            "label": "domain/converters/learning.grid.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.grid.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-grid-converter-ts"
          }
        }
      ],
      "callers": [
        {
          "file": "domain/converters/learning.grid.converter.ts",
          "name": "searchGrid",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-grid-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.grid.converter.ts",
            "label": "domain/converters/learning.grid.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.grid.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-grid-converter-ts"
          }
        }
      ],
      "exported": false,
      "flow": "relay",
      "kind": "lexical_declaration",
      "line": 84,
      "name": "improvements",
      "signature": "const improvements = function improvements("
    },
    {
      "callable": false,
      "callees": [],
      "callers": [
        {
          "file": "domain/converters/tension.converter.ts",
          "name": "edgeText",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-tension-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/tension.converter.ts",
            "label": "domain/converters/tension.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/tension.converter.ts.md",
            "ref": "anatomy:file-domain-converters-tension-converter-ts"
          }
        }
      ],
      "exported": false,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 50,
      "name": "pick",
      "signature": "let pick = 0;"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "domain/converters/learning.grid.converter.ts",
          "name": "improvements",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-grid-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.grid.converter.ts",
            "label": "domain/converters/learning.grid.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.grid.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-grid-converter-ts"
          }
        }
      ],
      "exported": false,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 63,
      "name": "neighbors",
      "signature": "const neighbors = function neighbors(grid: LearningGrid, cell: number, goal: number): number[] {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "domain/converters/learning.grid.converter.ts",
          "name": "improvements",
          "source": {
            "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-grid-converter-ts",
            "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.grid.converter.ts",
            "label": "domain/converters/learning.grid.converter.ts",
            "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.grid.converter.ts.md",
            "ref": "anatomy:file-domain-converters-learning-grid-converter-ts"
          }
        }
      ],
      "callers": [],
      "exported": true,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 102,
      "name": "searchGrid",
      "signature": "export const searchGrid = function searchGrid(grid: LearningGrid, start: number, goal: number): Int32Array {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 4,
      "name": "NEIGHBORS",
      "signature": "const NEIGHBORS: readonly (readonly [number, number])[] = ["
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 11,
      "name": "MARGIN",
      "signature": "const MARGIN = 2;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "interface_declaration",
      "line": 13,
      "name": "Visit",
      "signature": "interface Visit {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 18,
      "name": "gridFor",
      "signature": "export const gridFor = function gridFor(model: LearningModel): LearningGrid {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 19,
      "name": "wide",
      "signature": "const wide = Math.ceil(model.width / GRID_STEP) + MARGIN;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 20,
      "name": "tall",
      "signature": "const tall = Math.ceil(model.height / GRID_STEP) + MARGIN;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 21,
      "name": "blocked",
      "signature": "const blocked = new Uint8Array(wide * tall);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 23,
      "name": "x0",
      "signature": "const x0 = Math.max(0, Math.floor((block.x - MARGIN) / GRID_STEP));"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 24,
      "name": "x1",
      "signature": "const x1 = Math.min(wide - 1, Math.ceil((block.x + block.width + MARGIN) / GRID_STEP));"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 25,
      "name": "y0",
      "signature": "const y0 = Math.max(0, Math.floor((block.y - MARGIN) / GRID_STEP));"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 26,
      "name": "y1",
      "signature": "const y1 = Math.min(tall - 1, Math.ceil((block.y + block.height + MARGIN) / GRID_STEP));"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 36,
      "name": "cellAt",
      "signature": "export const cellAt = function cellAt(grid: LearningGrid, point: LearningPoint): number {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 49,
      "name": "cheapestOf",
      "signature": "const cheapestOf = function cheapestOf(heap: readonly Visit[]): number {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 51,
      "name": "scan",
      "signature": "for (let scan = 1; scan < heap.length; scan += 1) {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 59,
      "name": "stepCost",
      "signature": "const stepCost = function stepCost(grid: LearningGrid, cell: number, spent: number): number {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 64,
      "name": "cx",
      "signature": "const cx = cell % grid.wide;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 65,
      "name": "cy",
      "signature": "const cy = Math.floor(cell / grid.wide);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 66,
      "name": "found",
      "signature": "const found: number[] = [];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 68,
      "name": "nx",
      "signature": "const nx = cx + dx;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 69,
      "name": "ny",
      "signature": "const ny = cy + dy;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 70,
      "name": "inside",
      "signature": "const inside = nx >= 0 && ny >= 0 && nx < grid.wide && ny < grid.tall;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 71,
      "name": "step",
      "signature": "const step = ny * grid.wide + nx;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "interface_declaration",
      "line": 79,
      "name": "Reached",
      "signature": "interface Reached {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 90,
      "name": "better",
      "signature": "const better: Visit[] = [];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 92,
      "name": "spent",
      "signature": "const spent = stepCost(grid, step, here.spent);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 103,
      "name": "reached",
      "signature": "const reached: Reached = {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 107,
      "name": "heap",
      "signature": "const heap: Visit[] = [{ cell: start, spent: 0 }];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 111,
      "name": "here",
      "signature": "const here = heap.splice(cheapestOf(heap), 1)[0] ?? { cell: start, spent: 0 };"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 122,
      "name": "walkBack",
      "signature": "export const walkBack = function walkBack(grid: LearningGrid, came: Int32Array, start: number, goal: number): number[] {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 123,
      "name": "back",
      "signature": "const back: number[] = [];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 124,
      "name": "cursor",
      "signature": "let cursor = goal;"
    }
  ],
  "document": null,
  "findings": [],
  "generated": false,
  "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-grid-converter-ts",
  "language": "typescript",
  "layer": "processing",
  "name": "learning.grid.converter.ts",
  "path": "domain/converters/learning.grid.converter.ts",
  "ref": "anatomy:file-domain-converters-learning-grid-converter-ts",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/tree#folder-domain-converters",
          "json": "https://banes-lab.com/json/anatomy/tree/folder-domain-converters",
          "label": "domain/converters",
          "markdown": "https://banes-lab.com/anatomy/tree/folder-domain-converters.md",
          "ref": "chapter:/anatomy/tree#folder-domain-converters"
        }
      ],
      "relation": "contained-in"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-fragment-converter-ts",
          "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.fragment.converter.ts",
          "label": "domain/converters/learning.fragment.converter.ts",
          "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.fragment.converter.ts.md",
          "ref": "anatomy:file-domain-converters-learning-fragment-converter-ts"
        },
        {
          "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-tension-converter-ts",
          "json": "https://banes-lab.com/json/source/tree/domain/converters/tension.converter.ts",
          "label": "domain/converters/tension.converter.ts",
          "markdown": "https://banes-lab.com/source/tree/domain/converters/tension.converter.ts.md",
          "ref": "anatomy:file-domain-converters-tension-converter-ts"
        }
      ],
      "relation": "used-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/tree#folder-domain-converters",
          "json": "https://banes-lab.com/json/anatomy/tree/folder-domain-converters",
          "label": "domain/converters",
          "markdown": "https://banes-lab.com/anatomy/tree/folder-domain-converters.md",
          "ref": "chapter:/anatomy/tree#folder-domain-converters"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "slots": {
    "concern": "converter",
    "subject": "learning",
    "variant": "grid"
  },
  "stats": {
    "bytes": 4565,
    "callable": 9,
    "definitions": 36,
    "edges": 2,
    "exported": 19,
    "files": 1,
    "findings": {},
    "flows": {
      "leaf": 3,
      "relay": 1,
      "entry": 1,
      "isolated": 31
    },
    "lines": {
      "blank": 13,
      "code": 120,
      "total": 133
    }
  },
  "summary": "120 lines of code and 36 definitions.",
  "text": "https://banes-lab.com/source/tree/domain/converters/learning.grid.converter.ts.txt",
  "tree": "tree",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-route-converter-ts",
      "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.route.converter.ts",
      "label": "domain/converters/learning.route.converter.ts",
      "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.route.converter.ts.md",
      "ref": "anatomy:file-domain-converters-learning-route-converter-ts"
    },
    "previous": {
      "href": "https://banes-lab.com/anatomy/tree#file-domain-converters-learning-fragment-converter-ts",
      "json": "https://banes-lab.com/json/source/tree/domain/converters/learning.fragment.converter.ts",
      "label": "domain/converters/learning.fragment.converter.ts",
      "markdown": "https://banes-lab.com/source/tree/domain/converters/learning.fragment.converter.ts.md",
      "ref": "anatomy:file-domain-converters-learning-fragment-converter-ts"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/source/tree/domain/converters",
    "label": "domain/converters",
    "markdown": "https://banes-lab.com/api/source/tree/domain/converters.md",
    "ref": "api:source/tree/domain/converters"
  }
}
