コード例 #1
0
 public void moveDiscs(int n, HanoiTower destination, HanoiTower buffer)
 {
     if (n > 0)
     {
         moveDiscs(n - 1, buffer, destination);
         MoveTopTo(destination);
         buffer.moveDiscs(n - 1, destination, this);
     }
 }
コード例 #2
0
        public void MoveTopTo(HanoiTower tower)
        {
            int top = discs.Pop();

            tower.Add(top);
        }