I’m already unfamiliar with the game and the formula. But I’m assuming the formula is mostly correct.
I’d want to verify this, but assuming it’s correct this should give to probability that exactly k of the unknown n dice are the same value.
Prob(n,k) = fact(n)/(fact(k)*fact(n-k))*((1/3)^k)*((2/3)^(n-k))
That’s with wilds. Without wilds 1/6 and 5/6 sounds reasonable.
Normally for the ai to decide to say Liar or not it looks at the probability that there are at least k dice with the same value.
So for example if there are four unknown dice.
The probability of at least 2 being the same would be:
Prob(4,2)+prob(4,3)+prob(4,4)
And the probability of exactly two being the same would be
Prob(4,2)
The formula with the summarization I gave before would find at most or
Prob(4,2)+prob(4,1)
Which doesn’t seem right.