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
B Amend your code to keep track of the total number of moves in the game, by writing a function PlayHanoipos a b c n j which has an additional input which will be zero on the initial input to serve as a movecounter, and which outputs suitably modified pos j Define a function WholeGamen which runs PlayHanoi on a suitable starting configuration.
This might be tricky depending on how you coded B: the danger is that the counting variable 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.
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
