The challenge was to write a short script in a scripting language of choice that takes in an image of mixed up uniform sized shreds and pieces them back into the unshredded and reconstituted image. That means the original image was divided into an even number of columns of same size and than those columns were shuffled randomly. Additionally the script should auto-detecting how wide the uniform strips are.
Before I started on my solution, I made some quick assumptions to simplify things:
- I wanted to code it in Ruby, simply because it's a great language and I'm quite productive in it.
- I wanted to define a simple distance measure which can be used for auto-detecting the column size and putting the shredded image back into its original state.