From f6f16b1dc677b3536dacfdf7e04fda0b9236605c Mon Sep 17 00:00:00 2001 From: Jacob Louis Hoover Date: Wed, 26 Jan 2022 18:08:22 -0500 Subject: [PATCH 1/2] 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) --- src/lib/words.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/words.ts b/src/lib/words.ts index 140f0c9..cabfed6 100644 --- a/src/lib/words.ts +++ b/src/lib/words.ts @@ -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, } From 3478533926d2ea5c2c06bb7ddf3d15e0afaf12a9 Mon Sep 17 00:00:00 2001 From: Jacob Louis Hoover Date: Wed, 26 Jan 2022 18:10:42 -0500 Subject: [PATCH 2/2] Update words.ts --- src/lib/words.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/words.ts b/src/lib/words.ts index cabfed6..bdd1556 100644 --- a/src/lib/words.ts +++ b/src/lib/words.ts @@ -21,7 +21,7 @@ export const getWordOfDay = () => { const nextday = (index + 1) * msInDay + epochMs return { - solution: WORDS[index % WORDS.length].toUpperCase() + solution: WORDS[index % WORDS.length].toUpperCase(), solutionIndex: index, tomorrow: nextday, }