Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Aug 17, 2024
1 parent 6c8f3e6 commit 9dfa41b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -777,27 +777,32 @@ <h4 id="yesterday-or-random" class="answers">Yesterday's answers</h4>
var puzzle = allpuzzles.at(seed % 131071 % numpuzzles)
var start = Math.floor(seed / numpuzzles) % 7;

if (date.getFullYear() == 2024 && date.getMonth() == 5 && date.getDate() == 16) {
puzzle = "fathsre";
if (date.getMonth() == 8 && date.getDate() == 18) {
puzzle = "eighxnt";
start = 1;
}

return puzzle.slice(start) + puzzle.slice(0, start);
}

function valid_word(puzzle, word) {
var current = "";

for (var letter of word) {
current += letter;
if (puzzle.includes(current)) {
current = "";
}
}

return current == "";
}

function get_words(puzzle) {
var puzzlewords = [];

for (var word of allwords) {
var valid = true;
for (var letter of word) {
if (!puzzle.includes(letter)) {
valid = false;
break;
}
}

if (valid && word.includes(puzzle.at(-1))) {
if (valid_word(puzzle, word) && word.includes(puzzle.at(-1))) {
puzzlewords.push(word);
}
}
Expand Down

0 comments on commit 9dfa41b

Please sign in to comment.