Question: B 4 Amend your code to keep track of the total number of moves in the game, by writing a function PlayHanoi 2 ( pos

B4 Amend your code to keep track of the total number of moves in the game, by writing a function PlayHanoi2(pos, a , b, c, n, j) which has an additional input j(which will be zero on the initial input) to serve as a move-counter, and which outputs suitably modified (pos, j). Define a function WholeGame2(n) which runs PlayHanoi2 on a suitable starting configuration.
This might be tricky depending on how you coded B3: the danger is that the counting variable j will assume different values in different subroutines. Make sure you keep careful track of the current game position and number of moves throughout your function.
 B4 Amend your code to keep track of the total number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!