예제 #1
0
        public virtual void Reset()
        {
            Statistics.Restarts++;

            Current = Start;
            PuzzleStack.Clear();
        }
예제 #2
0
        public virtual void Init(Puzzle puzzle)
        {
            if (puzzle == null)
            {
                throw new ArgumentNullException("puzzle");
            }

            Start = Current = puzzle;

            PuzzleStack.Clear();
            PuzzleStack.Push(puzzle);
        }
예제 #3
0
        public virtual bool UndoMove()
        {
            if (PuzzleStack.Count < 2)
            {
                return(false);
            }

            Statistics.Undos++;

            PuzzleStack.Pop(); // Discard top
            Current = PuzzleStack.Peek();

            return(true);
        }
예제 #4
0
 public virtual void Init()
 {
     PuzzleStack.Clear();
     PuzzleStack.Push(Start);
 }
예제 #5
0
 private void UpdateState(Map newState)
 {
     PuzzleStack.Push(newState);
     Current = newState;
 }