Skip to content

Add game state persistence to allow players to resume after page refresh#88

Closed
Parvathy-pp wants to merge 1 commit into
FOSSCLUB-LBSITW:mainfrom
Parvathy-pp:game-state-persistence
Closed

Add game state persistence to allow players to resume after page refresh#88
Parvathy-pp wants to merge 1 commit into
FOSSCLUB-LBSITW:mainfrom
Parvathy-pp:game-state-persistence

Conversation

@Parvathy-pp
Copy link
Copy Markdown

:

📌 Description

This PR implements game state persistence using localStorage to prevent loss of progress when the page is refreshed or reopened.

The game now restores the previous state, allowing players to continue from where they left off.

🔗 Related Issue

Closes: #78

🛠 Changes Made

Added saveGameState() function to store game state in localStorage

Added loadGameState() function to restore saved game state on page load

Stored and restored:

Flipped and matched cards

Player scores

Current player turn

Ensured matched cards remain unclickable after reload

✅ Checklist

[x] I have tested my changes

[x]My code follows project guidelines

[x]I have linked the related issue

@github-actions github-actions Bot added HackTheStack as a part of hack the stack event level-2 labels Feb 27, 2026
@FOSSCLUB-LBSITW
Copy link
Copy Markdown
Owner

Hi 👋
Thanks for working on game state persistence — this is an important feature.
I noticed that this PR shows a large number of deletions (around 289 lines) in script.js, along with merge conflicts.
Also, please update your branch with the latest main and resolve the conflicts so we can properly review the changes.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HackTheStack as a part of hack the stack event level-2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add game state persistence to allow players to resume after page refresh

2 participants