基于c#开发的汉诺塔游戏
编程语言:C# 带音效带自动演示 核心代码 private void Hanoi ( int n1 , char x , char y , char z ) { if ( n1 == 1 ) { MoveDisc ( x , 1 , z ) ; //编号为1的盘子从x到y } else { Hanoi ( n1 - 1 , x , z , y ) ; //n-1个盘子从x经y到z; MoveDisc ( x , n1 , z ) ; //编号为n的盘子从x到z; Hanoi ( n1 - 1 , y , x , z ) ; //n-1个盘子从y经x到z; } } private void MoveDisc ( char x , int n1 , char z ) { int j , t = 0 ; i = i + 1 ; labeloutput . Text + = "\r\n" + i . ToString ( ) . PadLeft ( 2 ) + ":砖块" + n1 . ToString ( ) . PadLeft ( 2 ) + x + "→" + z ; labeloutput . Visible = true ; buttonwatch . Visible = true ; buttonclean . Visible = true ; /