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

2048 #1053

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Dushkaaa-BabyBoss
Copy link

@Dushkaaa-BabyBoss Dushkaaa-BabyBoss commented Nov 28, 2024

- [DEMO LINK](https://Dushkaaa-BabyBoss.github.io/js_2048_game/)

Copy link

@TarasHoliuk TarasHoliuk left a comment

Choose a reason for hiding this comment

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

Try to fix tests

this.status = 'idle'; // Початковий статус гри
}

moveLeft() {

Choose a reason for hiding this comment

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

it works even before I click "start" button - it should be fixed:

image

this.board[i] = newRow;
}

this.addRandomTile();

Choose a reason for hiding this comment

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

You should not add a new tile if nothing changed:

image

Then I clicked left, as result - the new tile appeared:
image


/**
* Resets the game.
*/
restart() {}
restart() {

Choose a reason for hiding this comment

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

after clicking restart, the button text is "Start", but new tiles appeared and I can play

}

moveLeft() {
this.checkLose();

Choose a reason for hiding this comment

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

it should be done in after move - same as checkWin (no need to do it in each "move" method)

.reverse()
.filter((value) => value !== 0);

for (let j = 0; j < newRow.length - 1; j++) {

Choose a reason for hiding this comment

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

code in this method is almost the same, but you do reverse before and after manipulations. Try to add reusable code to a separate function and reuse it instead of duplication

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

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

Good job!
You need to add favicon on the page
image

@@ -23,22 +23,201 @@ class Game {
constructor(initialState) {
// eslint-disable-next-line no-console
console.log(initialState);

// Ініціалізуємо гральну дошку

Choose a reason for hiding this comment

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

Remove all comments

Suggested change
// Ініціалізуємо гральну дошку

Copy link

@VitaliyBondarenko1982 VitaliyBondarenko1982 left a comment

Choose a reason for hiding this comment

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

Good job.
Almost done.
When game not started, shouldn't any tiles on board.
Screenshot 2024-12-02 at 17 31 42

Copy link

@TarasHoliuk TarasHoliuk left a comment

Choose a reason for hiding this comment

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

LGTM, great job!

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.

4 participants