function encodeGridMap
encodeGridMap(grid: boolean[][]): string

Encodes rows of booleans as a <gridMap>.

Examples

Only the top-left cell on

import { assertEquals } from "@std/assert";
import { encodeGridMap } from "./encode-grid-map.ts";

const grid = Array.from({ length: 2 }, () => Array.from({ length: 22 }, () => false));
grid[0][0] = true;

assertEquals(encodeGridMap(grid), "800000000000");

Parameters

grid: boolean[][]

grid[row][column], every row the same length.

Return Type

string

The hex text, rows padded to whole bytes.

Usage

import { encodeGridMap } from ".";