Question: help me fix it . we do not allowed to move aux 3 direct to aux 2 V = ( Start , Al , A
help me fix it we do not allowed to move aux direct to aux
VStart Al A A Dest and
E Start DestDest AlAlDestAlAAAAAI
totalmoves
def move nst:
global totalmoves
totalmoves overlinemp
printftotalmoves: Move n from s to t
def MoveFowardnstart, target, aux aux aux:
if n:
move nstart, target
move ntarget, auxl
move n auxaux
move nauxaux
if n:
MoveFowardn start, target, aux aux aux
move nstart, target
move ntarget, aux
move n auxaux
MoveBackward n aux aux aux target
move n aux aux
MoveBackwardntarget, auxauxaux
def MoveBackward n aux aux aux target:
if n:
move n aux aux
move n aux aux
move n aux target
if n:
MoveBackwardnaux aux aux target
move naux aux
move nauxaux
MoveBackwardn target, aux aux aux
move n aux target
MoveBackwardnaux aux aux target
def HanoiMain n start, target,auxauxaux:
if n
move n start, target
if n:
MoveFowardnstart, target, auxauxaux
move nstart, target
MoveBackwardn aux aux aux target
Numberofpegs intinputWhat is the number of disk:
HanoiMinNumberofpegs,'start','dest',alaa
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
