From 77dd2d87befe587f475d6d4790738b6dfb65fce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Flar=20Tural=C4=B1?= <23704367+caglarturali@users.noreply.github.com> Date: Sun, 7 Jul 2024 13:51:06 +0300 Subject: [PATCH] Feat: dim wrong rects --- css/style.css | 4 ++++ js/wordmasters.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 7002034..d8bdf10 100644 --- a/css/style.css +++ b/css/style.css @@ -97,6 +97,10 @@ body { color: white; } +.rect.fail { + color: #bbb; +} + .rect.success { background-color: #08a045; color: white; diff --git a/js/wordmasters.js b/js/wordmasters.js index 8e00427..f5193fd 100644 --- a/js/wordmasters.js +++ b/js/wordmasters.js @@ -93,12 +93,14 @@ const wordmasters = { } } - // Correct letter, wrong place + // Correct letter, wrong place or wrong letter for (let i = 0; i < wordLen; i++) { if (theWord[i] === theGuess[i]) continue; // Already marked if (theWord.includes(theGuess[i]) && letterFreqs[theGuess[i]] > 0) { this.board[this.currRow][i].classList.add('warning'); letterFreqs[theGuess[i]]--; + } else { + this.board[this.currRow][i].classList.add('fail'); } }