hanoi.scp

来自「一个脚本语言的解释器」· SCP 代码 · 共 18 行

SCP
18
字号

function hanoi(from, to, aux, n)
{
	if(n == 1)
	{
		print( "move ", n, "from", from, "to", to, "\n" );
		return;
	}
	hanoi(from, aux, to, n-1);
	print( "move ", n, "from", from, "to", to, "\n" );
	hanoi(aux, to, from, n-1);
}

function main()
{
	hanoi(" A ", " C ", " B ", 12 );
	print("hanoi over.\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?