Answer to Question #192328 in Python for Macky

Question #192328

Create an algortihm 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.


LINK PHOTO:


https://www.google.com/search?q=tower+of+hanoi+image&source=lnms&tbm=isch&sa=X&ved=2ahUKEwi6veGsgMPwAhVVFogKHVD6D2IQ_AUoAXoECAEQAw&biw=1366&bih=657#imgrc=W_DnmKgBwq_XxM


1
Expert's answer
2021-05-13T16:22:00-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS