
Write a program that prints the moves solving the Tower of Hanoi for the disk count given as its single argument, one move per line.
./hanoi_moves 1 | cat -eExpected result
A C$For your own tracking. Tests grade your code.
./hanoi_moves 2 | cat -eExpected result
A B$
A C$
B C$./hanoi_moves 3 | cat -eExpected result
A C$
A B$
C B$
A C$
B A$
B C$
A C$./hanoi_moves 0 | cat -eExpected result
(empty result)
./hanoi_moves 3 2 | cat -eExpected result
wrong number of arguments$Expected files
hanoi_moves.cAllowed functions
atoiwrite
v0.40: Create exercises. Challenge the community.
Meet Studio →Write a program that prints the moves solving the Tower of Hanoi for the disk count given as its single argument, one move per line.
./hanoi_moves 1 | cat -eExpected result
A C$For your own tracking. Tests grade your code.
./hanoi_moves 2 | cat -eExpected result
A B$
A C$
B C$./hanoi_moves 3 | cat -eExpected result
A C$
A B$
C B$
A C$
B A$
B C$
A C$./hanoi_moves 0 | cat -eExpected result
(empty result)
./hanoi_moves 3 2 | cat -eExpected result
wrong number of arguments$Expected files
hanoi_moves.cAllowed functions
atoiwrite
Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.