18 lines
526 B
Plaintext
18 lines
526 B
Plaintext
function factorial(n) {
|
|
if (n <= 1) return 1;
|
|
return n * factorial(n - 1);
|
|
}
|
|
var wordSequenceMatcher = match => {
|
|
if (match.pattern !== 'wordSequence') {
|
|
return 0;
|
|
}
|
|
// Base guesses: factorial of word count (number of ways to order the words)
|
|
const baseGuesses = factorial(match.wordCount);
|
|
// Additional penalty for longer sequences
|
|
const lengthPenalty = 2 ** (match.wordCount - 2);
|
|
return baseGuesses * lengthPenalty;
|
|
};
|
|
|
|
export { wordSequenceMatcher as default };
|
|
//# sourceMappingURL=scoring.mjs.map
|