Towers of Hanoi: Difference between revisions

Content added Content deleted
(→‎[[Forth]]: make portable, example without locals)
(Perl)
Line 116: Line 116:
}
}
}
}

==[[Perl]]==
[[Category:Perl]]
sub move {
my $n = shift;
my $from = shift;
my $to = shift;
my $via = shift;
if ($n == 1) {
print "Move disk from pole $from to pole $to.\n";
} else {
move($n - 1, $from, $via, $to);
move(1, $from, $to, $via);
move($n - 1, $via, $to, $from);
};
};


==[[Pop11]]==
==[[Pop11]]==