/// <summary> /// Prints the field to Console.Out /// </summary> public void DumpToConsole() { var toprow = FinishStacks.Cast<CardStack>() .Concat(new[] { Stock }); DumpRows(toprow); DumpRows(PlayStacks.ToArray()); }
public bool IsDone() { return PlayStacks .SelectMany(s => s) .All(card => card.Visible); }
public PatienceField(Stock stock, IEnumerable<PlayStack> playStacks, IEnumerable<FinishStack> finishStacks) { Stock = stock; PlayStacks = playStacks.ToList(); FinishStacks = finishStacks.ToList(); _playStacksOrdered = PlayStacks.Where(s => s.Count > 0).OrderBy(s => s.Top.GetHashCode()).ToList(); _hash = DoGetHashCode(); }
private int DoGetHashCode() { var mystacksOrdered = PlayStacks.OrderByDescending(s => s.GetHashCode()); var hashcode = 0; foreach (var stack in mystacksOrdered) hashcode = hashcode * 81 + stack.GetHashCode(); return hashcode; }
/// <summary> /// Gets valid destination stacks, from least to most likely to lead to a solution /// </summary> /// <returns></returns> public IEnumerable<CardStack> GetDestinationStacks() { return PlayStacks.Cast<CardStack>() .Concat(FinishStacks.Cast<CardStack>()); }