Question- This pseudo code is going as advanced as while and if statements.
Prepare a general set of instructions that will allow us to change any displayed value (from 0 to 9) to any desired value (from 0 to 9) in the least number of steps.
For case, if the displayed value is 1 and the desired value is 0, we should move the thumbwheel down once, rather than move it up nine times.
- The only tricky part is figuring out the general condition that expresses whether it's best to move the thumbwheel up or down to reach the desired value.
- To make life easier, let's assume that we are allowed to use the conditions "it's best to go up" and/or "it's best to go down", in addition to the conditions mentioned in
Question - Would we ever decide it's best to go up and later in solving the same problem decide it is now better to go down or vice versa?
Please give a detailed answer so that I may learn from it. Thank you!