private static void move1(Column from, Column to) { to.rings[to.height] = from.rings[from.height - 1]; to.height = to.height + 1; from.height = from.height - 1; to.Validate(); from.Validate(); }
private static int Main() { int NUM = 17; Column[] cols = new Column[3]; cols[0].Init(NUM, NUM); cols[1].Init(NUM, 0); cols[2].Init(NUM, 0); return 100; }
private static int Main() { int NUM = 17; Column c1 = new Column(); Column c2 = new Column(); Column c3 = new Column(); c1.Init(NUM, NUM); c2.Init(NUM, 0); c3.Init(NUM, 0); return 100; }
private static int Main() { Column c1 = new Column(17, 17); Column c2 = new Column(17, 0); Column c3 = new Column(17, 0); int ec = move(ref c1, ref c2, ref c3, 17) - 130971; c1.Validate(); c2.Validate(); c3.Validate(); return ec; }
private static int move(Column from, Column to, Column temp, int num) { int C = 1; if (num == 1) { move1(from, to); } else { C += move(from, temp, to, num - 1); move1(from, to); C += move(temp, to, from, num - 1); } return C; }
private static int move(ref Column from, ref Column to, ref Column temp, int num) { to.Validate(); from.Validate(); temp.Validate(); int C = 1; if (num == 1) { move1(ref from, ref to); } else { C += move(ref from, ref temp, ref to, num - 1); move1(ref from, ref to); C += move(ref temp, ref to, ref from, num - 1); } return C; }