From f1a4f6db0827fc27ff94259c898e56c524cb2ab0 Mon Sep 17 00:00:00 2001 From: wreeshab Date: Mon, 3 Jun 2024 00:47:50 +0530 Subject: [PATCH] remove minor bug from replay feature --- hackerplus.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackerplus.js b/hackerplus.js index cc5cd66..50d1b24 100644 --- a/hackerplus.js +++ b/hackerplus.js @@ -300,6 +300,7 @@ function loadGameStateHistoryFromLocal() { return []; } } + function replayGame() { const history = loadGameStateHistoryFromLocal(); winnerNotice.style.visibility = "hidden"; @@ -311,7 +312,7 @@ function replayGame() { let index = 0; function replayNextMove() { - if (index < history.length) { + if (index < history.length-1) { const gameState = history[index]; startPieces = gameState.pieces; ricochetRotation = gameState.rotation;