From ba28926219dbbbb6b250c89111d8bef8c6b18264 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 13 Dec 2022 11:05:20 +0100 Subject: [PATCH] Add a method for resetting the game --- src/js/Game.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/js/Game.js b/src/js/Game.js index 2ce8d02..ee227d9 100644 --- a/src/js/Game.js +++ b/src/js/Game.js @@ -57,6 +57,15 @@ export class Game this.draw(); } + /** + * Resets the game. + */ + reset() + { + this.#state = new State(); + this.draw(); + } + /** * Replaces the content of the board with the current state. */