Ejemplo n.º 1
0
        public void Undo()
        {
            int currTurn   = CurrItem.Turn;
            int targetTurn = currTurn - 2;

            while (Past.Count > 0 && currTurn != targetTurn)
            {
                Future.Push(Past.Pop());

                if (Past.Count <= 0)
                {
                    currTurn = 1;
                }
                else
                {
                    CurrItem = Past.Peek();
                    currTurn = CurrItem.Turn;
                }
            }

            // check if can revert
            //if (Past.Count > 2)
            //{
            //    Future.Push(Past.Pop());
            //    Future.Push(Past.Pop());

            //    CurrItem = Past.Peek();
            //}
        }