## Permanent Programming#7

Put your programming skills to the test in these challenges.

### Permanent Programming#7

Sorry about the other one I posted,
when I typed in my question and pressed submit, it
told me that I couldn't post again so soon.

My question is how could I actually know where to
move each line of the image?

I'm thinking it has to be something along the lines of
lining up the pixels of a certain color on either side of
the text, but I'm not positive.
s3klyma
New User

Posts: 16
Joined: Tue Apr 22, 2008 3:19 pm
Blog: View Blog (0)

### Re: Permanent Programming#7

TheMindRapist
Contributor

Posts: 585
Joined: Mon Apr 14, 2008 4:57 pm
Blog: View Blog (0)

### Re: Permanent Programming#7

There are several ways of solving this. It'd be a bit pointless if you were told how to work out where to move each line, since that's most of the challenge. evinyatar (the person who coded the new version) solved it a completely different way to me. Before you start coding, think "how will I tell if I've unscrambled it" then start thinking up an algorithm.

Nines
Poster

Posts: 191
Joined: Sun Apr 13, 2008 5:57 pm
Blog: View Blog (0)

### PHP

i am getting the image ,but not so clear to make out!
What algo Should i use?I use the first half set of pixels in each row SUM
Here is the source:Removed
EDT:
I Tried using another algo:get the RGB value of each pixels of the row and so the total sum of the R ,G,B values.Now do a % calculation of which one has the most value of R or G, or B,then arrange according to order.It worked fine with a downloaded image of unscrambled image.(i.e an unscrambled image will give back the same output without much working..)but it fails to give the correct output still now!
bluesun
New User

Posts: 1
Joined: Fri Jun 13, 2008 3:00 pm
Blog: View Blog (0)

### Re: Permanent Programming#7

Hi,

thank you for this challenge, it was fun. It did take me a few days to figure it out how to solve it.

I think I coded a new solution for this (it kinda' reminds me on how ocr software work), so I'd like to add a hint: it's not even necessary to unscramble the image lines to solve this challenge.

Cheers,
kl223
(p.s. I did it using bash+sed. )
kl223
New User

Posts: 5
Joined: Sat Sep 06, 2008 6:25 pm
Blog: View Blog (0)

### Re: Permanent Programming#7

it is suposed that i have to get better results than these?
http://img301.imageshack.us/my.php?image=screenshotua7.jpg
because I have tried a lot of diferent algorithms and still i only can read some characters....
old_red_boots
New User

Posts: 16
Joined: Tue Sep 23, 2008 4:49 am
Location: spain
Blog: View Blog (0)

### Re: Permanent Programming#7

old_red_boots wrote:it is suposed that i have to get better results than these?
http://img301.imageshack.us/my.php?image=screenshotua7.jpg
because I have tried a lot of diferent algorithms and still i only can read some characters....

sure, there is way how to get the solution clear like this (3 random pictures):

tio
New User

Posts: 22
Joined: Tue May 13, 2008 11:01 am
Location: Slovakia
Blog: View Blog (0)

### Re: Permanent Programming#7

pfff i have to work more on this . I supose i'm ordering the wrong data, however, i don't think i will get such good results as yours
old_red_boots
New User

Posts: 16
Joined: Tue Sep 23, 2008 4:49 am
Location: spain
Blog: View Blog (0)

### Re: Permanent Programming#7

I'm really curious how you guys managed to get it that clear like that. At first I tried depending on the background, looping through each line, and for each one, selecting the one below it which had the lowest average difference in R, G, and B values for each pixel compared to the ones directly below it. That didn't work at all, it just seems like the background is far too blurred to be of any use like that.

What I eventually ended up doing was filtering out all the lines for each of the two "words", and processing each individually, looking for the line that kept each of the characters the most continuous. This worked well enough that I could tell what the letters said, except there was know way of knowing which was supposed to be first and which was second, so there was only a 50% chance of getting it right.
f22
New User

Posts: 13
Joined: Sun Sep 28, 2008 10:06 pm
Blog: View Blog (0)

### Re: Permanent Programming#7

The difficulty rating of this level is "hard" and maybe this is the reason why you are finding complicated patterns and relations between rows in that picture. In fact, it should be like medium because when I compare programming 3 with this one, 3th level is more harder (and prog3 is like medium, not hard. That's bullshit ). You need realized, that if you want sort lines of this pictures, you will need find something what is unique for each row. (the background do them unique too, therefore you shouldn't ignore it)
I'm sure there is another way how to solve it too and maybe the algorithm based on sorting which I used is not the best, but it works in 90% of pictures.
tio
New User

Posts: 22
Joined: Tue May 13, 2008 11:01 am
Location: Slovakia
Blog: View Blog (0)

Next

### Who is online

Users browsing this forum: No registered users and 0 guests