export function create2DArray<T>(height: number, width: number, cell: T | (() => T)): T[][] {
  return Array.from({ length: height }, () =>
    Array.from({ length: width }, () => (cell instanceof Function ? cell() : cell))
  );
}
export function get2DArrayItem<T>(
  grid: T[][],
  first: number,
  second: number,
  colFirst: boolean
): T {
  return colFirst ? grid[first][second] : grid[second][first];
}
