Skip to content

Commit

Permalink
Feat: dim wrong rects
Browse files Browse the repository at this point in the history
  • Loading branch information
caglarturali committed Jul 7, 2024
1 parent af5ea94 commit 77dd2d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ body {
color: white;
}

.rect.fail {
color: #bbb;
}

.rect.success {
background-color: #08a045;
color: white;
Expand Down
4 changes: 3 additions & 1 deletion js/wordmasters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down

0 comments on commit 77dd2d8

Please sign in to comment.