16 November 2011

My good friend +Zsolt Szasz challenged me to the unshredder challenge. I decided to try something different this time and solve the problem using python.

Setting up

So my first task was to setup python and the PIL image library on my windows machine. I had python installed but the PIL installer couldn’t find it, so I had reinstall python. After that I did a quick check:

>>> from PIL import Image
>>> quit()

No errors so I was ready to go!

Learning python as you code

I had used python a bit earlier but honestly too little. So this was a nice chance to learn some more. Luckily they had some sample code to get started with.

After fixing some syntax issues from my copy-paste, I had a the example program running and producing the image seen below!

First solution

It took me 2-3 hours to get the image unshredded.

I used the nice python tutorial a lot and getting used to the syntax took a while (no semicolons! no curly braces!). But I found python to be really easy and powerful language!

Here’s the solution, not very elegant but pretty readable IMO ;).

Better solution

I have updated my solution with a solution to the bonus challenge.

Links

sources



blog comments powered by Disqus