diff --git a/src/js/Game.js b/src/js/Game.js index 0f44c5a..3a36f34 100644 --- a/src/js/Game.js +++ b/src/js/Game.js @@ -31,6 +31,13 @@ export class Game */ #board; + /** + * The element containing a log message. + * + * @type {HTMLElement} + */ + #log; + /** * The id of the element to add the board to. * @@ -79,7 +86,14 @@ export class Game class: "board" }); + this.#log = elt( + "div", + { + class: "log" + }); + container.appendChild(this.#board); + container.appendChild(this.#log); this.draw(); } @@ -137,6 +151,18 @@ export class Game board.appendChild(field); } } + + board.appendChild( + elt( + "div", + { + style: "clear: both;" + })); + + this.#log.className = ""; + this.#log.classList.add(this.state.currentPlayer); + this.#log.innerHTML = ""; + this.#log.textContent = `It's player "${Constants.PLAYER_NAMES[this.state.currentPlayer]}"s turn`; } /**