1
0
Fork 0

Show which guesses are common/bonus words and give counts.

feature/save-game
Daniel Perelman 5 years ago
parent 75e1ce990b
commit 848b561e4c

@ -46,7 +46,16 @@
resultDisplay.appendChild(linkCell);
let guesses = document.getElementById('guesses');
if (results.length > 0) resultDisplay.classList.add('solved');
if (results.length > 0) {
resultDisplay.classList.add('solved');
document.getElementById('clues_solved').innerText++;
} else if (this.game.allTopWords.has(guess)) {
resultDisplay.classList.add('top_word');
document.getElementById('top_words_found').innerText++;
} else {
resultDisplay.classList.add('bonus');
document.getElementById('bonus_words_found').innerText++;
}
guesses.prepend(resultDisplay);
this.clearUnlocked();
@ -262,6 +271,9 @@
}
}
}
document.getElementById('clues_total').innerText = game.clues.length;
document.getElementById('top_words_total').innerText = game.allTopWords.size - game.clues.length;
}
}
@ -368,7 +380,14 @@
<button id="shuffle"></button>
<div id="available_letters"></div>
</div>
<table id="guesses">
</table>
<div id="guess_list">
<div id="guess_counts">
<span class="solved">Clues: <span id="clues_solved">0</span>/<span id="clues_total">?</span></span>,
<span class="top_word">Other common words: <span id="top_words_found">0</span>/<span id="top_words_total">?</span></span>,
<span class="bonus">Bonus words: <span id="bonus_words_found">0</span></span>
</div>
<table id="guesses">
</table>
</div>
</body>
</html>

@ -20,6 +20,13 @@
.solved, #crossword td.solved {
background-color: yellow;
}
.top_word {
background-color: cyan;
}
.bonus {
background-color: lightgreen;
}
#guesses {
border-collapse: collapse;
margin-top: 0.5em;
}

Loading…
Cancel
Save