diff --git a/example-puzzles/example/2/puzzle.moth b/example-puzzles/example/2/puzzle.moth index 2576b31..50d7918 100644 --- a/example-puzzles/example/2/puzzle.moth +++ b/example-puzzles/example/2/puzzle.moth @@ -3,6 +3,7 @@ Summary: Static puzzle resource files File: salad.jpg s.jpg File: salad2.jpg s2.jpg hidden Answer: salad +X-Answer-Pattern: *pong You can include additional resources in a static puzzle, by dropping them in the directory and listing them in a `File:` header field. diff --git a/theme/puzzle.js b/theme/puzzle.js index 868bc80..2c084c6 100644 --- a/theme/puzzle.js +++ b/theme/puzzle.js @@ -83,15 +83,15 @@ async function possiblyCorrect(answer) { if (djb2hash(answer) == correctHash) { return answer } - for (let len = 0; len <= answer.length; len += 1) { - if (window.puzzle.xAnchors.includes("end") && (len != answer.length)) { + for (let end = 0; end <= answer.length; end += 1) { + if (window.puzzle.xAnchors.includes("end") && (end != answer.length)) { continue } - for (let pos = 0; pos < answer.length - len + 1; pos += 1) { - if (window.puzzle.xAnchors.includes("begin") && (pos > 0)) { + for (let beg = 0; beg < answer.length; beg += 1) { + if (window.puzzle.xAnchors.includes("begin") && (beg != 0)) { continue } - let sub = answer.substring(pos, pos+len) + let sub = answer.substring(beg, end) let digest = await sha256Hash(sub) if (digest == correctHash) {