21 lines
589 B
Text
21 lines
589 B
Text
;Task:
|
|
Given a jumbled list of the numbers '''1''' to '''9''' that are definitely ''not'' in
|
|
ascending order.
|
|
|
|
Show the list, and then ask the player how many digits from the
|
|
left to reverse.
|
|
|
|
Reverse those digits, then ask again, until all the digits end up in ascending order.
|
|
|
|
|
|
The score is the count of the reversals needed to attain the ascending order.
|
|
|
|
|
|
Note: Assume the player's input does not need extra validation.
|
|
|
|
|
|
;Related tasks:
|
|
* [[Sorting algorithms/Pancake sort]]
|
|
* [[wp:Pancake sorting|Pancake sorting]].
|
|
* [[Topswops]]
|
|
<br><br>
|