Skip to content

Commit

Permalink
fix: terminate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sazanik committed Nov 7, 2024
1 parent 614999e commit fa5eea8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ class BrainGames {

console.log(description);

const answers = [];

for (let i = 0; i < this.attemptsCount; i += 1) {
answers.push(game());
}
if (!game()) {
this.sympathize(this.name);

if (answers.every(Boolean)) {
this.congratulate(this.name);
} else {
this.sympathize(this.name);
return;
}
}

this.congratulate(this.name);
}
}

Expand Down

0 comments on commit fa5eea8

Please sign in to comment.