Programming 1

Put your programming skills to the test in these challenges.

Re: Permanent Programming 1

Post by tio on Wed Jul 09, 2008 3:56 pm
([msg=7004]see Re: Permanent Programming 1[/msg])

Junke1990 wrote:does anyone got some tips how to do it with pascal/delphi???

copy all and paste into memo. Then parse for separate single words and you can start ;)
tio
New User
New User
 
Posts: 22
Joined: Tue May 13, 2008 11:01 am
Location: Slovakia
Blog: View Blog (0)


Re: Permanent Programming 1

Post by brodeur235 on Thu Jul 10, 2008 12:34 pm
([msg=7075]see Re: Permanent Programming 1[/msg])

Tips:
For C, C++, and Objective-C users I recommend, for the main algorithm, which will compare the scrambled word to each and every unscrambled word, using the int() and char() functions to give each word, with it's own collection (but not specifically organization) of letters their own unique numeric identifier. Here is an example to better depict this;

Consider you had the scrambled word 'aabac' and the unscrambled word in the list was 'abaca'. The algorithm would get an integer value for the scrambled word 'aabac' by multiplying (for example) all it's letter's ascii values, using the int function, like so:

int(a) * int(a) * int(b) * int(a) * int(c)

The numeric value for which would correctly match that of the unscrambled word 'abaca', whose value would be found in the same way.

I hope this helped just to get people start thinking, but wasn't a spoiler. If it was please delete this post. Happy programming,

Brodeur235
brodeur235
New User
New User
 
Posts: 11
Joined: Fri May 23, 2008 2:54 pm
Location: United States, TX
Blog: View Blog (0)


Re: Permanent Programming 1

Post by mastaraymond on Sun Jul 13, 2008 4:58 pm
([msg=7350]see Re: Permanent Programming 1[/msg])

I'm having huge problems with the lay-out of the answer..

My program spits this out:
joshua-uhjosa
august-uagsut
hatton-othant
leslie-seilel
michel-ielmhc
clancy-layncc
patrick-atikrpc
marley-yalerm
tintin-inttni
wright-tighrw
joshua,august,hatton,leslie,michel,clancy,patrick,marley,tintin,wright

with a original word list of
# uhjosa
# uagsut
# othant
# seilel
# ielmhc
# layncc
# atikrpc
# yalerm
# inttni
# tighrw

For example, but when I fill this in joshua,august,hatton,leslie,michel,clancy,patrick,marley,tintin,wright it gives me a "wrong answer error"...
I'm stuck.
mastaraymond
New User
New User
 
Posts: 1
Joined: Sun Jul 13, 2008 4:54 pm
Blog: View Blog (0)


Re: Programming 1

Post by LupoBHS on Tue Jul 15, 2008 3:12 am
([msg=7448]see Re: Programming 1[/msg])

Hey can someone just tell me why everytime I try installing any program on my computer there is something always going wrong. At first I tried out Python it was working great for me but my stupid Vista had to corrupt the files so now I can't use that. Then, I tried using Perl but when I downloaded it, it only gave me the Perl Package Manager not the whole program (I also found out that Perl is not freeware please tell me if this is true). Then I tried using PHP but everytime I try typing in localhost or 127.0.0.1 in the URL it keeps taking me to the XAMPP homepage and I cant get around it. Have I not installed everything? PLEASE! Tell me what I am doing wrong! Thank you
LupoBHS
New User
New User
 
Posts: 7
Joined: Tue Apr 29, 2008 2:38 am
Blog: View Blog (0)


Re: Permanent Programming 1

Post by Qubit on Thu Jul 17, 2008 12:36 am
([msg=7606]see Re: Permanent Programming 1[/msg])

brodeur235 wrote:Tips:
For C, C++, and Objective-C users I recommend, for the main algorithm, which will compare the scrambled word to each and every unscrambled word, using the int() and char() functions to give each word, with it's own collection (but not specifically organization) of letters their own unique numeric identifier.

<snip>

A couple of immediate problem. One, since the ASCII values aren't prime number, the product isn't guaranteed to be unique for the different starting values. Two, it only take a few letters for the product to overflow.
To everyone is given the key to the gates of heaven, but the same key opens the gate of hell.
Qubit
New User
New User
 
Posts: 17
Joined: Tue Jul 15, 2008 8:28 pm
Blog: View Blog (0)


Re: Programming 1

Post by flagrl on Tue Jul 22, 2008 9:53 am
([msg=7993]see Re: Programming 1[/msg])

can you do this in python?
flagrl
New User
New User
 
Posts: 5
Joined: Mon Jul 21, 2008 4:26 pm
Blog: View Blog (0)


Re: Permanent Programming 1

Post by telaryus on Thu Jul 24, 2008 10:50 pm
([msg=8219]see Re: Permanent Programming 1[/msg])

mastaraymond wrote:I'm having huge problems with the lay-out of the answer..

My program spits this out:
joshua-uhjosa
august-uagsut
hatton-othant
leslie-seilel
michel-ielmhc
clancy-layncc
patrick-atikrpc
marley-yalerm
tintin-inttni
wright-tighrw
joshua,august,hatton,leslie,michel,clancy,patrick,marley,tintin,wright

with a original word list of
# uhjosa
# uagsut
# othant
# seilel
# ielmhc
# layncc
# atikrpc
# yalerm
# inttni
# tighrw

For example, but when I fill this in joshua,august,hatton,leslie,michel,clancy,patrick,marley,tintin,wright it gives me a "wrong answer error"...
I'm stuck.


The answer you got is correct in the sense of words and commas. The issue I think most people are having with the syntax is that they are also copying a new-line / line-feed -- carriage-return characters along with their answer.

When I was working out bugs on my python script for this that seemed to be the thing that threw me off for a bit.

Hope that helps, hang in there!

Telaryus
"My word is my bond and here I stand."
"My word is my bond and here I stand."
telaryus
New User
New User
 
Posts: 2
Joined: Thu Jul 24, 2008 10:45 pm
Blog: View Blog (0)


Re: Programming 1

Post by XertroV on Fri Jul 25, 2008 8:54 pm
([msg=8293]see Re: Programming 1[/msg])

You should be able to do it in any language that can either accept input, handle connections to the interwebs, or start other applications.

For example I used Visual C# to run wget for windows, log in and download the file, then unscramble it by logical deduction.
(I use linux alot, and so wget was a natural reaction for me)
XertroV
New User
New User
 
Posts: 1
Joined: Fri Jul 25, 2008 8:51 pm
Blog: View Blog (0)


Re: Programming 1

Post by fashizzlepop on Fri Jul 25, 2008 10:44 pm
([msg=8298]see Re: Programming 1[/msg])

LupoBHS wrote:Then I tried using PHP but everytime I try typing in localhost or 127.0.0.1 in the URL it keeps taking me to the XAMPP homepage and I cant get around it. Have I not installed everything? PLEASE! Tell me what I am doing wrong! Thank you



All you need would be some free webspace... ulmb.com is perfect and it supports PHP 5.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: Programming 1

Post by telaryus on Sat Jul 26, 2008 12:38 pm
([msg=8329]see Re: Programming 1[/msg])

Yes, you can program this in Python. That was the language I choose since it is the one i am currently learning.
Wrote the program in under 30 lines of code and it runs 16ms on average ^^
Which basically gives you 30 seconds to do everything else. i.e. copy and pasting.

Although I would like to be able to script this to get the page and submit the answer for me, but I don't even know where to start with that. So if anyone could throw me some pointers that would be appreciated. (telaryus@hotmail.com)

Good luck and thanks.

~Telaryus
"My word is my bond and here I stand."
"My word is my bond and here I stand."
telaryus
New User
New User
 
Posts: 2
Joined: Thu Jul 24, 2008 10:45 pm
Blog: View Blog (0)


PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests