Skip to content

Commit

Permalink
remove minor bug from replay feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wreeshab committed Jun 2, 2024
1 parent c37c939 commit f1a4f6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hackerplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function loadGameStateHistoryFromLocal() {
return [];
}
}

function replayGame() {
const history = loadGameStateHistoryFromLocal();
winnerNotice.style.visibility = "hidden";
Expand All @@ -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;
Expand Down

0 comments on commit f1a4f6d

Please sign in to comment.