A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:
- Split the string into equal sections.
- Reverse the string, and starting from the start of each string.
- Put runs of a random length between 1 and the number of characters left into the final string
- Then remove these characters from the strings.
An example
"Hello World!" Output string = ""
"Hello ", "World!" ""
"Hell", "World!" " o"
"Hell", "World" " o!"
"Hel", "World" " o!l"
"Hel", "Wo" " o!ldlr"
"H", "Wo" " o!ldlrle"
"H", "" " o!ldlrleoW"
"", "" " o!ldlrleoWH"
The final product from Hello World!
could be o!ldlrleoWH
and that is what you would output.
Robbers
Your task is to take a Cops submission and rearrange so that it produces a valid riffle shuffler program. You may not add, remove or change any characters in the original program to result in your solution.
If the program works, even if it is not the cops intended solution, it is a valid crack.
The winner is the person who cracks the most Cops submissions!