ChromeGaming / Dot-Box

Dot-Box is a game where players take turns drawing lines between dots to create boxes. The player who completes the most boxes wins. It's a simple yet strategic game enjoyed by people of all ages.
https://chromegaming.github.io/Dot-Box/
MIT License
97 stars 181 forks source link

Enhance Gameplay with Undo Move Functionality #45

Open Vemurinikitha opened 1 month ago

Vemurinikitha commented 1 month ago

Do you want to have the enhancement of existing game ? 😀 Describe yourself..

To improve the player experience and provide greater flexibility during gameplay, let's enhance the game by adding an undo move option. This feature will allow players to retract their last move if they make a mistake or change their strategy, enhancing the overall fluidity and enjoyment of the game

Describe the solution you'd like

let moves = []; // Array to store moves

function makeMove(move) { moves.push(move); // Add move to array console.log("Move made:", move); }

function undoMove() { if (moves.length > 0) { let lastMove = moves.pop(); // Remove and get last move console.log("Undoing move:", lastMove); } else { console.log("No moves to undo."); } }

// Example usage: makeMove("Player 1 moves to position (x, y)"); makeMove("Player 2 moves to position (x, y)"); undoMove(); // Undo last move

Select program in which you are contributing

GSSoC23

Code of Conduct

Dilpreet0501 commented 1 month ago

Hello @Durgesh4993 , kindly assign me this issue under GSSoC'24. I'll do my best !

Durgesh4993 commented 1 month ago

@Dilpreet0501 Please raise any other issue, i'll assign you If you have any doubt you can directly send message on our discord (https://discord.gg/rZb46cCMmK), we have created seprate chennals for all projects...

Thank you :)

Dilpreet0501 commented 1 month ago

Sure @Durgesh4993 , Thank you