Loop solutions

Loop the index, to avoid out of range error if the list is exhausted (quite easy to do if the wordlist is modified, as might be what's going on in https://github.com/hannahcode/wordle/issues/63)
This commit is contained in:
Jacob Louis Hoover 2022-01-26 18:08:22 -05:00 committed by GitHub
parent f8aa91766d
commit f6f16b1dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@ export const getWordOfDay = () => {
const nextday = (index + 1) * msInDay + epochMs
return {
solution: WORDS[index].toUpperCase(),
solution: WORDS[index % WORDS.length].toUpperCase()
solutionIndex: index,
tomorrow: nextday,
}