You don't need an algorithm. You can just record seeds that are solvable. The current version of Klondike in MS Solitaire is winnable unless you play "Random" difficulty.