Add a button for resetting the game

This commit is contained in:
Manuel Thalmann 2022-12-13 11:08:52 +01:00
parent ba28926219
commit 7950572ede
No known key found for this signature in database
GPG key ID: 5FD9AD3CCDDBD27B
2 changed files with 8 additions and 0 deletions

View file

@ -9,5 +9,8 @@
<body>
<div class="board" id="board">
</div>
<button class="button new-game">
New Game
</button>
</body>
</html>

View file

@ -14,6 +14,11 @@ function initialize()
{
game = new Game("board");
game.initialize();
(/** @type {HTMLElement} */ (document.querySelector(".new-game"))).onclick = () =>
{
game.reset();
};
}
initialize();