Create an algorithm, using python
Move each bar from tower A to tower C. You can only move one bar at a time. You are not allowed to place the larger disk onto a smaller disk.
tower(disk, A, B, C)
IF disk is equal 1, THEN
move disk from A to C
ELSE
tower(disk - 1, A, C, B)
move disk from A to C
tower(disk - 1, B, A, C)
END IF
END
Comments
Leave a comment