No, after a few tries, we decided to use a heuristic algorithm. Basically it's looking through all possible moves and checks which moves are getting us closer to solving the deck.