test: board

This commit is contained in:
Shibo Lyu 2024-04-30 22:15:45 +08:00
parent b2158a63c2
commit 302d6cef3e
3 changed files with 150 additions and 3 deletions

View file

@ -8,9 +8,13 @@ import type {
import { createSection } from "./section.ts";
export function createBoard(config: BoardConfig): BoardData {
const sections: SectionData[][] = Array(config.ySections).map((_, sy) =>
Array(config.xSections).map((_, sx) => createSection({ sx, sy }, config))
);
const sections: SectionData[][] = Array(config.ySections)
.fill(0)
.map((_, sy) =>
Array(config.xSections)
.fill(0)
.map((_, sx) => createSection({ sx, sy }, config))
);
return { config, sections };
}