diff --git a/src/CA.ts b/src/CA.ts index 60d2161..4c5fbf2 100644 --- a/src/CA.ts +++ b/src/CA.ts @@ -1,5 +1,5 @@ export function applyCellularAutomataRules(map: number[], width: number, height: number): number[] { - let newMap = new Array(width * height).fill(0); + const newMap = new Array(width * height).fill(0); for (let i = 0; i < height * width; i++) { for (let x = 0; x < width; x++) { diff --git a/src/main.ts b/src/main.ts index 20394f5..5ffcf1c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,8 @@ import "./style.css"; import { UI } from "@peasy-lib/peasy-ui"; -import { Engine, DisplayMode, TileMap, Rectangle, Color, Vector } from "excalibur"; +import { Engine, DisplayMode, TileMap, Vector } from "excalibur"; import { bluey, model, template, whitey } from "./ui"; +//@ts-expect-error import { PerlinGenerator } from "@excaliburjs/plugin-perlin"; export let generator: PerlinGenerator; @@ -33,7 +34,7 @@ export function drawTilemap() { //loop through tiles in tmap and grab noise value game.remove(game.currentScene.tileMaps[0]); let tileIndex = 0; - for (let tile of tmap.tiles) { + for (const tile of tmap.tiles) { const noise = generator.noise(tile.x / tmap.columns, tile.y / tmap.rows); if (noise > 0.5) { model.tiles[tileIndex] = 1; diff --git a/src/ui.ts b/src/ui.ts index 437cddf..1656dc7 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -6,11 +6,13 @@ export const bluey = new Rectangle({ width: 16, height: 16, color: Color.fromRGB export const whitey = new Rectangle({ width: 16, height: 16, color: Color.fromRGB(255, 255, 255, 1) }); export const model = { + //eslint-disable-next-line @typescript-eslint/no-empty-function resetSim: (_e: any, m: any) => { m.tiles = Array(1296).fill(0); getNewNoiseField(); drawTilemap(); }, + //eslint-disable-next-line @typescript-eslint/no-empty-function runSim: (_e: any, m: any) => { m.tiles = applyCellularAutomataRules(m.tiles, 36, 36); redrawTilemap(m.tiles, tmap, game); @@ -46,7 +48,7 @@ export const template = ` function redrawTilemap(map: number[], tilemap: TileMap, game: Engine) { game.remove(game.currentScene.tileMaps[0]); let tileIndex = 0; - for (let tile of tilemap.tiles) { + for (const tile of tilemap.tiles) { const value = map[tileIndex]; if (value == 1) { tile.addGraphic(bluey);