function hanoi($n, $from, $to, $aux) {
if ($n == 1) {
echo "Move disk 1 from rod $from to rod $to\n";
return;
}
hanoi($n-1, $from, $aux, $to);
echo "Move disk $n from rod $from to rod $to\n";
hanoi($n-1, $aux, $to, $from);
}
//example
hanoi(3, 'A', 'C', 'B');
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)