For knocking, a heuristic for how many turns vs. amount of deadwood (which should vary based on the undercut bonus you use) does "okay"; adding a bit of randomness should be done to prevent stronger players from being able to place a lower-bounds on your count may be a good idea.
On the other hand that might not work for poker or other information hiding games. (Chess, checkers, and connect four have no hidden info.) I seem to remember an algorithm that can handle this case, but I forgot the name. You’d have to research it.