This commit is contained in:
platane
2025-03-23 11:24:57 +01:00
parent 85e229a04d
commit c0a042d6b4
4 changed files with 140 additions and 66 deletions

View File

@@ -5,10 +5,22 @@ import { grid } from "./sample";
(async () => {
const api = await import("@snk/solver-r");
const g = api.Grid.create(grid.width, grid.height, grid.data);
const g = api.IGrid.create(grid.width, grid.height, grid.data);
const { canvas, draw, highlightCell } = createCanvas(g);
document.body.appendChild(canvas);
const freeCells = api.iget_free_cell(g);
draw({ width: g.width, height: g.height, data: g.cells }, [] as any, []);
console.log(freeCells);
{
const { canvas, draw, highlightCell } = createCanvas(g);
document.body.appendChild(canvas);
draw({ width: g.width, height: g.height, data: g.data }, [] as any, []);
for (let i = freeCells.length / 2; i--; ) {
const x = freeCells[i * 2 + 0];
const y = freeCells[i * 2 + 1];
highlightCell(x, y);
}
}
})();