Example #1
0
        /// <summary>
        /// Copies the old state into a new object.
        /// </summary>
        /// <param name="original">The state to copy.</param>
        public State(State original)
        {
            // Copy stock
            Stock = new StockCardStack(original.Stock);

            // Copy foundations
            for (int foundationIndex = 0; foundationIndex < original.Foundations.Count; ++foundationIndex)
            {
                Foundations[foundationIndex] = new FoundationCardStack(original.Foundations[foundationIndex]);
            }

            // Copy tableaus
            for (int tableauIndex = 0; tableauIndex < original.Tableaus.Count; ++tableauIndex)
            {
                Tableaus[tableauIndex] = new TableauCardStack(original.Tableaus[tableauIndex]);
            }

            CurrentStateNumber = original.CurrentStateNumber;

            // Set up card stacks
            CardStacks = new List <CardStack>
            {
                Stock,
                Stock.Waste
            }.Concat(Foundations).Concat(Tableaus).ToList();
        }
 /// <inheritdoc />
 /// <summary>
 /// Copies the stock stack.
 /// </summary>
 /// <param name="original">The original stock stack.</param>
 public StockCardStack(StockCardStack original) : base(original)
 {
     Waste = new WasteCardStack(original.Waste)
     {
         Stock = this
     };
     MoveAmount = original.MoveAmount;
 }