コード例 #1
0
 /// <summary>
 /// Prints the field to Console.Out
 /// </summary>
 public void DumpToConsole()
 {
     var toprow = FinishStacks.Cast<CardStack>()
         .Concat(new[] { Stock });
     DumpRows(toprow);
     DumpRows(PlayStacks.ToArray());
 }
コード例 #2
0
 public bool IsDone()
 {
     return
         PlayStacks
         .SelectMany(s => s)
         .All(card => card.Visible);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 /// <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>());
 }