Permanent Programming 2

Put your programming skills to the test in these challenges.

Re: Permanent Programming 2

Post by raddy1313 on Tue Jan 12, 2010 5:33 pm
([msg=33283]see Re: Permanent Programming 2[/msg])

This is the second programming mission I've solved with MATLAB...if you have knowledge/access to it, I highly recommend it. It has a lot useful pre-built functions (imread() for this one) and the scripting is pretty quick and easy.
"If I ever start a software company, I'm going to replace desks with toilets. I do my most inspired programming in the bathroom."
User avatar
raddy1313
New User
New User
 
Posts: 27
Joined: Wed Jan 06, 2010 12:22 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Spyrall2 on Tue Jan 19, 2010 11:05 am
([msg=33549]see Re: Permanent Programming 2[/msg])

raddy1313 wrote:This is the second programming mission I've solved with MATLAB...if you have knowledge/access to it, I highly recommend it. It has a lot useful pre-built functions (imread() for this one) and the scripting is pretty quick and easy.

MATLAB <3 :p
Today I had an exam and had to manipulate a picture using matlab :p (I had to program a magic want tool ^^)

But I wanted to do this challenge in java (because I want to imrpove my java ofcourse.. even though this would have been easier in matlab :) )

nevertheless :)
I still seem to have a 'problem' in my program :S
could someone help?

what do you find for the following image:
Image
I find:
NPPZ72TNBR (when my filter is 'low' -> everything with R, G and B above 200 is white)
NPPZR (when my filter is on 'high' -> everything must be above 240 to be seen as white)

(btw when the image comes DIRECT from the page where it was loaded, even at high I find the low values (so the LOW is correct, high is wrong here because of image compression of the hosing site..)


Regards,
Pieter
Last edited by Spyrall2 on Tue Jan 19, 2010 11:42 am, edited 1 time in total.
Spyrall2
New User
New User
 
Posts: 14
Joined: Sun Jan 17, 2010 7:55 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by faazshift on Tue Jan 19, 2010 11:30 am
([msg=33550]see Re: Permanent Programming 2[/msg])

Hey, I tried your image (going off of the 200 threshold). Imageshack definitely seems to be distorting the image. For the first value I got an R, rather than an N, but the rest of the values I got matched yours. Try offsetting your starting count so that it gets an R instead of an N and see if you can pass.
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Spyrall2 on Tue Jan 19, 2010 12:34 pm
([msg=33551]see Re: Permanent Programming 2[/msg])

faazshift wrote:Hey, I tried your image (going off of the 200 threshold). Imageshack definitely seems to be distorting the image. For the first value I got an R, rather than an N, but the rest of the values I got matched yours. Try offsetting your starting count so that it gets an R instead of an N and see if you can pass.

Now I finished the stupid thing by 'cheating' xD

I waited to get a pic where I got an N first and changed it to R :D
it worked, but still xD

I can't find the right spot to offset the thing x D - seriously.. I can't find it.. I thought it was logical but really.. I seem to be wrong ..

here is my code.. *SPOILER ALERT!!!!!!!!!*


This is the method that changes a picture into morse code...

[Removed by Defience]


And here is the methode that converts morse to Alphabetic


[Removed by Defience]
Spyrall2
New User
New User
 
Posts: 14
Joined: Sun Jan 17, 2010 7:55 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by faazshift on Tue Jan 19, 2010 12:41 pm
([msg=33553]see Re: Permanent Programming 2[/msg])

Hmm... strange. I only had to start with -1. It looks like you would need to initially set 'spot' to -4 for it to work correctly.
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Spyrall2 on Tue Jan 19, 2010 12:54 pm
([msg=33554]see Re: Permanent Programming 2[/msg])

minus 4?! x D

Would you mind checking that with some values? :p
I mean..

Maybe it was a coincidence that -4 worked (sorry for the trouble xD)

But if you can confirm that works for like 3 or 4 pictures : ) - it's okay

Even though I'll still be a bit frustrated because that makes no sence at all..


EDIT
BTW - I just checked it! but I still get NPPZ72TNBR - even with -4 (And that's logical!)
Changing the starting spot won't change the delta at all.. (the delta = ascii)
Spyrall2
New User
New User
 
Posts: 14
Joined: Sun Jan 17, 2010 7:55 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by faazshift on Tue Jan 19, 2010 1:20 pm
([msg=33558]see Re: Permanent Programming 2[/msg])

This seems like a really strange issue. I thoroughly looked over your code and the only thing that seems to makes sense is if the image class is somehow borking things.

PS how did you cheat on a dynamically generated mission?
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Spyrall2 on Tue Jan 19, 2010 1:34 pm
([msg=33559]see Re: Permanent Programming 2[/msg])

faazshift wrote:This seems like a really strange issue. I thoroughly looked over your code and the only thing that seems to makes sense is if the image class is somehow borking things.

PS how did you cheat on a dynamically generated mission?

Well only my first character was wrong ;p

And because my code-mistake doesn't change, when I got N from my code as a first character, I just changed THAT N to an R (like you reported you got for my N :p )
and BOOM - passed :D
Spyrall2
New User
New User
 
Posts: 14
Joined: Sun Jan 17, 2010 7:55 am
Blog: View Blog (0)


Re: Permanent Programming 2

Post by faazshift on Tue Jan 19, 2010 1:51 pm
([msg=33560]see Re: Permanent Programming 2[/msg])

Ahh... im not sure thats cheating, but it isn't the optimal method of solving it. Anyway, my approach involved a single loop to get the morse code. I had a counter variable that incremented at each iteration and each time I hit a white pixel I figured out the difference and stored my current position. Also, I made a class which constructed the entire morse code tree and walked the tree to figure out each character.
faazshift
Contributor
Contributor
 
Posts: 516
Joined: Wed Jun 03, 2009 3:55 pm
Location: Riverton, Utah
Blog: View Blog (0)


Re: Permanent Programming 2

Post by Defience on Tue Jan 19, 2010 3:41 pm
([msg=33564]see Re: Permanent Programming 2[/msg])

Spyrall2 wrote:
faazshift wrote:Hey, I tried your image (going off of the 200 threshold). Imageshack definitely seems to be distorting the image. For the first value I got an R, rather than an N, but the rest of the values I got matched yours. Try offsetting your starting count so that it gets an R instead of an N and see if you can pass.

Now I finished the stupid thing by 'cheating' xD

I waited to get a pic where I got an N first and changed it to R :D
it worked, but still xD

I can't find the right spot to offset the thing x D - seriously.. I can't find it.. I thought it was logical but really.. I seem to be wrong ..

here is my code.. *SPOILER ALERT!!!!!!!!!*


This is the method that changes a picture into morse code...

[Removed by Defience]


And here is the methode that converts morse to Alphabetic


[Removed by Defience]


Do not post your code for solving challenges that someone else may take and use for themselves. If you'd like someone to review it then put that in your post so you can email or pm them for that, but make sure they have completed the challenge themselves first.
User avatar
Defience
Addict
Addict
 
Posts: 1277
Joined: Thu Jun 12, 2008 3:16 pm
Blog: View Blog (0)


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests