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