Exemplo n.º 1
0
 public Hanoi(int biggestRing)
 {
     _biggestRing = biggestRing;
     _left        = new Stake(biggestRing);
     _center      = new Stake(0);
     _right       = new Stake(0);
 }
Exemplo 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);
        }
Exemplo n.º 3
0
 private void Accept(Stake sourceStake)
 {
     Accept(sourceStake.Take());
 }