示例#1
0
文件: hanoi.cs 项目: CheneyWu/coreclr
 private static int move(CI from, CI to, int num)
 {
     if (num == 1)
     {
         move1(from, to);
         return 1;
     }
     else
     {
         CI F, T;
         F.index = from.index;
         T.index = 3 - from.index - to.index;
         int c = move(F, T, num - 1);
         move1(from, to);
         F.index = 3 - from.index - to.index;
         T.index = to.index;
         return c + 1 + move(F, T, num - 1);
     }
 }
示例#2
0
 private static int move(CI from, CI to, int num)
 {
     if (num == 1)
     {
         move1(from, to);
         return(1);
     }
     else
     {
         CI F, T;
         F.index = from.index;
         T.index = 3 - from.index - to.index;
         int c = move(F, T, num - 1);
         move1(from, to);
         F.index = 3 - from.index - to.index;
         T.index = to.index;
         return(c + 1 + move(F, T, num - 1));
     }
 }
示例#3
0
        private static int Main()
        {
            CI c = new CI();

            return(100 + test(c, c, c, 0, c, c));
        }
示例#4
0
 private static int test(CI c1, CI c2, CI c3, int dummy, CI c4, CI c5)
 {
     c1._m_v = 10;
     c2._m_v = -10;
     return(c1._m_v + c2._m_v + c3._m_v + c4._m_v + c5._m_v);
 }
示例#5
0
 private static int Main()
 {
     CI c = new CI();
     return 100 + test(c, c, c, 0, c, c);
 }
示例#6
0
 private static int test(CI c1, CI c2, CI c3, int dummy, CI c4, CI c5)
 {
     c1._m_v = 10;
     c2._m_v = -10;
     return c1._m_v + c2._m_v + c3._m_v + c4._m_v + c5._m_v;
 }
示例#7
0
文件: hanoi.cs 项目: CheneyWu/coreclr
 private static void move1(CI from, CI to)
 {
     s_cols[to.index][s_heights[to.index]++] = s_cols[from.index][--s_heights[from.index]];
 }
示例#8
0
 private static void move1(CI from, CI to)
 {
     s_cols[to.index][s_heights[to.index]++] = s_cols[from.index][--s_heights[from.index]];
 }