Files
SnowLuma/.pnpm-store/v11/files/b1/402bdcfbd2ec8466d1ddbbf83f8f461d67f292dbcf8ea35ccbf63b5b2b01ec7979d4a1649d269cb1d901c07652508f47389312a480a823f538bf164c01c8a4
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

21 lines
550 B
Plaintext

import { MatchExtended, MatchEstimated } from '../../types'
function factorial(n: number): number {
if (n <= 1) return 1
return n * factorial(n - 1)
}
export default (match: MatchExtended | MatchEstimated): number => {
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
}