From 63bfb5375e39f3f4eacea1c8f7822400b2fbd3c2 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 13 Dec 2022 11:04:17 +0100 Subject: [PATCH] Create a dedicated `draw` method --- src/js/Game.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/Game.js b/src/js/Game.js index 8b254dd..2ce8d02 100644 --- a/src/js/Game.js +++ b/src/js/Game.js @@ -53,6 +53,14 @@ export class Game * Initializes the game. */ initialize() + { + this.draw(); + } + + /** + * Replaces the content of the board with the current state. + */ + draw() { let board = document.getElementById(this.id); board.innerHTML = ""; @@ -86,7 +94,7 @@ export class Game { this.board[i][j] = this.state.currentPlayer; this.state.turnCount++; - this.initialize(); + this.draw(); }; board.appendChild(field);