Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add task solution #1171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

JosielLinhar
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on implementing the 2048 game! 🎉 Your code meets the task requirements and effectively handles the game logic and user interactions. While there are a few minor improvements suggested, such as ensuring win/lose messages are hidden on restart and returning the updated state in some methods for consistency, these do not impact the core functionality. Keep up the good work and consider these enhancements for an even smoother user experience! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +77 to +83
moveRight() {
if (this.getStatus() === 'playing') {
this.reverseState();
this.moveLeft();
this.reverseState();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moveRight method does not return the updated state after performing the move. Consider returning this.state at the end of the method to maintain consistency with moveLeft.

Comment on lines +85 to +91
moveUp() {
if (this.getStatus() === 'playing') {
this.flipState();
this.moveLeft();
this.flipState();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moveUp method does not return the updated state after performing the move. Consider returning this.state at the end of the method to maintain consistency with moveLeft.

Comment on lines +93 to +99
moveDown() {
if (this.getStatus() === 'playing') {
this.flipState();
this.moveRight();
this.flipState();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moveDown method does not return the updated state after performing the move. Consider returning this.state at the end of the method to maintain consistency with moveLeft.

Comment on lines +24 to +32
game.restart();
updateTable(game.getState());
updateScore(game.getScore());
winOrLose();

button.classList.replace('restart', 'start');
button.innerHTML = 'Start';

messageStart.classList.remove('hidden');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When restarting the game, ensure that the win and lose messages are hidden. Currently, only the start message is shown, but if the game was previously won or lost, those messages might still be visible. Consider adding messageWin.classList.add('hidden'); and messageLose.classList.add('hidden'); to ensure they are hidden when the game restarts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants