From ce4ce48af2da829e8ff7674e66c73f881b7d2182 Mon Sep 17 00:00:00 2001 From: Mikita Date: Fri, 8 Nov 2024 01:44:10 +0300 Subject: [PATCH] fix: terminate logic --- src/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 9b42242..cca356e 100644 --- a/src/index.js +++ b/src/index.js @@ -13,16 +13,14 @@ 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); + + return; + } - if (answers.every(Boolean)) { this.congratulate(this.name); - } else { - this.sympathize(this.name); } } }