Esempio n. 1
0
 public Hanoi(int biggestRing)
 {
     _biggestRing = biggestRing;
     _left        = new Stake(biggestRing);
     _center      = new Stake(0);
     _right       = new Stake(0);
 }
Esempio n. 2
0
        public virtual void Move(Ring ringToMove, Stake targetStake, Stake temporaryStake)
        {
            if (CanTake(ringToMove))
            {
                targetStake.Accept(this);
                return;
            }

            Move(ringToMove.Smaller(), temporaryStake, targetStake);

            targetStake.Accept(this);

            temporaryStake.Move(ringToMove.Smaller(), targetStake, this);
        }
Esempio n. 3
0
 private void Accept(Stake sourceStake)
 {
     Accept(sourceStake.Take());
 }