Programming 1

Put your programming skills to the test in these challenges.

Re: Programming 1

Post by mutants_r_us_guild on Fri Aug 01, 2008 1:14 pm
([msg=8620]see Re: Programming 1[/msg])

You can use JS for that... get grease monkey for FF (theres something similar fo IE too)...

I had to use it for prog1 so that It would display the words in one line rather than a list... so it would be command line friendly.

P.S. I used DOS and the prime number anagram theory. Worked pretty well. :)
Image
Image
Image
User avatar
mutants_r_us_guild
Poster
Poster
 
Posts: 246
Joined: Fri May 30, 2008 7:56 pm
Blog: View Blog (0)


Re: Programming 1

Post by nathandelane on Mon Aug 04, 2008 2:53 pm
([msg=8852]see Re: Programming 1[/msg])

I did this using just C#. My bottleneck was in the fact that I did NOT read the scrambled words from the web page automatically (so basically I was the bottleneck). I had to paste the words in two different programs quickly to get rid of the newline characters, then paste them as a command-line argument to my program. Probably would have been more efficient to make it a Windows Forms app instead of command-line. Anyway, I output the text exactly as it should have been input into the challenge as console output. I had 4 remaining seconds when I posted my answer. I think that's pretty good.

I read the list of words in, then tokenized them by "\r\n", went through each word for each arg and if the size matched first, then I compared, otherwise I ignored the word in the dictionary list. I used a hash table (Dictionary<k,v>) to maintain position and the character being matched, and if all of the letters were matched (i.e. hash table length == scrambled word length) then I wrote out the word. I also used the hash table to ensure that I didn't match the same letter twice where there were duplicates by increasing the index on the substring (to pull the character from the word, i.e. word.SubString(index, 1)) by the index of the initial matching char. Kinda complex I guess, but the program takes less than 500 milliseconds to complete the task. (Pentium 4 3.2GHz, 2.0 GB RAM, dual core processor, Visual Studio 2005 C# Express, and .NET 2.0 framework).
Me, Nathandelane, Highly influential to Hackerdom, Premature Optimization=http://c2.com/cgi/wiki?PrematureOptimization
User avatar
nathandelane
Poster
Poster
 
Posts: 204
Joined: Thu Jun 26, 2008 11:26 am
Location: Utah
Blog: View Blog (0)


Re: Permanent Programming 1

Post by rsox709 on Mon Aug 04, 2008 6:56 pm
([msg=8861]see Re: Permanent Programming 1[/msg])

make sure you remember that the list of words to unscramble gets changed every time...its not a consistent list. that may solve many peoples problems
rsox709
New User
New User
 
Posts: 2
Joined: Sun Aug 03, 2008 7:29 pm
Blog: View Blog (0)


Re: Permanent Programming 1

Post by Jspapp on Sun Aug 10, 2008 9:10 am
([msg=9268]see Re: Permanent Programming 1[/msg])

Sepanto wrote:err... Guys does anyone know how to code in C a command to open the zip file? it takes very valuable seconds which cause me sometimes to lose. that and converting the input to a list without "# " before it.


You don't need to reopen the list every time you try, you get the same one each time. Just download it once.
Jspapp
New User
New User
 
Posts: 1
Joined: Sun Aug 10, 2008 9:08 am
Blog: View Blog (0)


Re: Programming 1

Post by atrius on Tue Aug 12, 2008 6:15 am
([msg=9441]see Re: Programming 1[/msg])

I like my way. I can copy and paste *straight* from the webpage, *including newlines, spaces, and the # symbol*, and my program gives me the answer :) then its just a copy + paste back.

Although, my way is quite inefficient.
There is no descrambling at all, either. Which i think is pretty cool, because I had no idea how to descramble efficiently (has to be efficient because the computer that my app runs on is crap, so long calculations take ages).
atrius
New User
New User
 
Posts: 19
Joined: Wed Aug 06, 2008 7:23 am
Blog: View Blog (0)


Re: Programming 1

Post by Draggonn on Sun Aug 24, 2008 3:51 am
([msg=10353]see Re: Programming 1[/msg])

I was thinking of solving it with linked lists using C++.. Or is it too much hassle for this program and I should try a simpler way?
Draggonn
New User
New User
 
Posts: 1
Joined: Sun May 11, 2008 11:12 am
Blog: View Blog (0)


Re: Programming 1

Post by urnotmega on Wed Aug 27, 2008 1:15 am
([msg=10536]see Re: Programming 1[/msg])

Hi all,

new to this site... just stumbled upon it tonight. I just wanted to stop in and say hi, and that I did the first programming challenge (or whatever it's called) with PHP. My program does everything and spits out a comma delimited string, all I had to do was copy/paste the list from the site to my program, save, run it, and copy/paste the answer to the site.

if anyone runs into an issue with your list being "wrong" but really isn't, check the end of the string for an extra space. I ran into that issue copy/pasting from one tab to the next - it added an extra space that shouldn't be there.

Anyway, cool stuff... going to check out some more challenges now.
urnotmega
New User
New User
 
Posts: 1
Joined: Wed Aug 27, 2008 1:11 am
Blog: View Blog (0)


Re: Permanent Programming 1

Post by vladiftodi on Fri Aug 29, 2008 1:26 pm
([msg=10621]see Re: Permanent Programming 1[/msg])

Sepanto wrote:err... Guys does anyone know how to code in C a command to open the zip file? it takes very valuable seconds which cause me sometimes to lose. that and converting the input to a list without "# " before it.


ehhh
The wordlist.zip is the permanent wordlist of files
(REad carefulyl the challange)
10 random words are chosen from that list and scrambled...
So you don't need to downlaod it each time <.<

didn't understand your question on imput?
make it read from a file
and you just copy it pase save and run script :)
(take care to remove the tabs that exist when you copy from HTS due to the list points...
also you may need to add an extra line or "\n" so the last line is read...
vladiftodi
New User
New User
 
Posts: 44
Joined: Thu May 22, 2008 12:29 pm
Blog: View Blog (0)


Re: Programming 1

Post by mosshack on Sat Aug 30, 2008 11:50 am
([msg=10669]see Re: Programming 1[/msg])

Lol You guys must be stupid xD
cyrano = Crayon

xD
mosshack
New User
New User
 
Posts: 18
Joined: Wed Apr 30, 2008 4:59 pm
Blog: View Blog (0)


Re: Programming 1

Post by cpsim on Sat Aug 30, 2008 2:45 pm
([msg=10675]see Re: Programming 1[/msg])

ok if i get flamed i get flamed lol. either i am looking at this wrong or the words are not coming from the word list.
getting ready to write the app. and i got to looking at the words to unscramble and the word list. there not matching up. here is the words i would have been unscrambling

# yfdrde
# ensisunh
# oomoom
# imebzo
# footxtr
# ajmomrod
# gsegia
# 1tamrse
# 1nj36ho
# mletnie

and here is the wordlist

html:)
121212
131313
123123
654321
8675309
666666
696969
888888
1234567
21122112
12345678
asdfjkl;
hal9000
bond007
ncc1701d
ncc1701e
ncc1701
thx1138
a12345
abcd1234
1234qwer
1a2b3c
1q2w3e
test123
1p2o3i
puppy123
kitten12
qwerty12
john316
apollo13
ne1469
amanda1
mazda1

starting to think just throw the wordlist out. this is not the first compare i have done. out of the 20 have not been able to match one word in the list.
cpsim
New User
New User
 
Posts: 1
Joined: Sat Aug 30, 2008 2:35 pm
Blog: View Blog (0)


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests