import { create2dState, create1dStateOneCell, create1dState } from "./core.js"; import { getRandomInt } from "./common.js"; function Board(width, height, grid = []) { this.width = width; this.height = height; (this.cellProperties = { size: 3, liveColor: "#000000", deadColor: "#F5F5F5", }), (this.grid = grid); } // create a first state, either a single living cell // at the center or random ones const create1dInitialState = (board, type = "onecell") => { if (type === "onecell") return create1dStateOneCell(board.width); return create1dState(board.width, getRandomInt, [0, 2]); }; // initialize 2d board with random cells const create2dRandomGrid = (width, height) => { return create2dState(width, height, getRandomInt, [0, 2]); }; export { Board, create1dInitialState, create2dRandomGrid };