private void Check(int column) { from = column; fromPile = FindTableau[from]; if (fromPile.Count == 0) { // No cards. return; } // Configure the working tableau. WorkingTableau.Variation = Variation; // Find roots. Roots.Clear(); int row = fromPile.Count; Roots.Add(row); while (row > 0) { int count = fromPile.GetRunUpAnySuit(row); row -= count; Roots.Add(row); } int runs = Roots.Count - 1; if (runs <= 1) { // Not at least two runs. return; } // Check first with no uncovering moves. best = -1; CheckOne(Move.Empty); Used.Clear(); for (int i = 0; i < UncoveringMoves.Count; i++) { // Make sure the move doesn't interfere. Move move = UncoveringMoves[i]; if (move.From == from || move.To == from) { continue; } // Only need to try an uncovered card once. if (Used.Contains(move.From)) { continue; } Used.Add(move.From); // The uncovered card has to match a root to be useful. Card uncoveredCard = FindTableau[move.From][move.FromRow - 1]; bool matchesRoot = false; for (int j = 1; j < Roots.Count; j++) { if (uncoveredCard.IsTargetFor(fromPile[Roots[j]])) { matchesRoot = true; break; } } if (!matchesRoot) { continue; } // Try again to find a composite single pile move. move.ToRow = -1; CheckOne(move); } }