From 2cf011ed03ae2c19d7e147bdb599db38a42f15c8 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 13 Dec 2022 11:12:06 +0100 Subject: [PATCH] Store the board size as static variables --- src/js/Game.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/Game.js b/src/js/Game.js index ee227d9..a3003d5 100644 --- a/src/js/Game.js +++ b/src/js/Game.js @@ -7,6 +7,16 @@ import { State } from "./State.js"; */ export class Game { + /** + * The width of the board. + */ + static #width = 7; + + /** + * The height of the board. + */ + static #height = 6; + /** * The state of the game. * @@ -74,9 +84,9 @@ export class Game let board = document.getElementById(this.id); board.innerHTML = ""; - for (let i = 0; i < 6; i++) + for (let i = 0; i < Game.#height; i++) { - for (let j = 0; j < 7; j++) + for (let j = 0; j < Game.#width; j++) { /** @type {Node[]} */ let children = [];