Programmer's Corner Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Programmer's Corner - Forums


Crack the Code

 
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Code Wars
Author Message
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Mon Feb 02, 2004 11:14 am    Post subject: Crack the Code Reply with quote

Ok, here is the puzzle.

Assume that you have the following phrase: 312125

And the code is: A=1, B=2, C=3, etc.

AND! 121 could be:

1 2 1 - A B A
12 1 - L A
1 21 - A U

What word (an English word btw) is that?

AND! What other possible words fit that phrase. Remember, this is February, so the phrase may have something to do with that.



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 5:36 am    Post subject: Re: Crack the Code Reply with quote

trying by hand the second try i did gave me : clay


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
bdi
Nobody


Joined: 21 Oct 2004
Posts: 1646
Location: Chicago

PostPosted: Tue Feb 03, 2004 7:50 am    Post subject: Re: Crack the Code Reply with quote

What does clay have to do with february? (c(3)l(12)a(1)y(25))


Programmer's Corner - tutorials, articles, forums, and code for C++, SQL, .NET, java, and, web development
Visual Basic Explorer - support forums and source code for all your Visual Basic 6 needs!
the drop ship guide - The complete guide on how to get started with wholesale drop shipping.

Back to top
bdi
Nobody


Joined: 21 Oct 2004
Posts: 1646
Location: Chicago

PostPosted: Tue Feb 03, 2004 7:51 am    Post subject: Re: Crack the Code Reply with quote

or Cable?


Programmer's Corner - tutorials, articles, forums, and code for C++, SQL, .NET, java, and, web development
Visual Basic Explorer - support forums and source code for all your Visual Basic 6 needs!
the drop ship guide - The complete guide on how to get started with wholesale drop shipping.

Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 8:07 am    Post subject: Re: Crack the Code Reply with quote

was a bit bored .. so did this in notepad :

======================

312125

======================

C - 12125
C - A - 2125
C - A - B - 125
C - A - B - A - 25
C - A - B - A - B - 5
C - A - B - A - B - E

======================

C - A - B - A - 25
C - A - B - A - Y

======================

C - A - B - 125
C - A - B - L - 5
C - A - B - L - E

======================

C - A - 2125
C - A - U - 25
C - A - U - B - E

======================

C - A - U - 25
C - A - U - Y

======================

C - 12125
C - L - 125
C - L - A - 25
C - L - A - B - 5
C - L - A - B - E

======================

C - L - A - 25
C - L - A - Y

======================

C - L - 125
C - L - L - 5
C - L - L - E

======================

of which i only know : 'clay' and 'cable'


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 8:19 am    Post subject: Re: Crack the Code Reply with quote

hmm we could get more words if we take the '(x -1) mod 26 + 1' of the nrs .. for example
31 -> 5 -> E

then we can get 'ebay' :)


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
bdi
Nobody


Joined: 21 Oct 2004
Posts: 1646
Location: Chicago

PostPosted: Tue Feb 03, 2004 8:37 am    Post subject: Re: Crack the Code Reply with quote

That second post is a sign you were really bored! LOL


Programmer's Corner - tutorials, articles, forums, and code for C++, SQL, .NET, java, and, web development
Visual Basic Explorer - support forums and source code for all your Visual Basic 6 needs!
the drop ship guide - The complete guide on how to get started with wholesale drop shipping.

Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 8:39 am    Post subject: Re: Crack the Code Reply with quote

nah .. the real sign that i was (am) bored is that i started to create a vb program which would show all the possible words (assume we allow the 'mod') ..

i got stuck on the recursive part though .. have to think it through before i put it in code :)


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Tue Feb 03, 2004 8:44 am    Post subject: Re: Crack the Code Reply with quote

I got Cable and Clay also. I started on a C# version, but didn't get very far...



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 8:45 am    Post subject: Re: Crack the Code Reply with quote

hey! you submitted the puzzle .. you should at least know what it has to do with february :)


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Tue Feb 03, 2004 8:47 am    Post subject: Re: Crack the Code Reply with quote

No, I said it MAY have something to do with February. :)



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Edited by: RedLeif at: 2/3/04 8:47 am
Back to top
Hrqls
De Blonde Puffin


Joined: 22 Oct 2004
Posts: 558
Location: Alkmaar, The Netherlands

PostPosted: Tue Feb 03, 2004 8:53 am    Post subject: Re: Crack the Code Reply with quote

hmm .. 'may' or 'february' .. make up your mind :p

hmm ... to create 'may' we need an 'm' which is 13 .. or 39 .. or 65 .. or ... hmm ..

could it be that the numbers are in hex ? :evil


The specialty of the house ? thats me (cheap as always)

Visual Basic Explorer - For all your Visual Basic 6 needs!
Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Tue Feb 03, 2004 8:54 am    Post subject: Re: Crack the Code Reply with quote

*sigh* GEEK!



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Back to top
Qnarcus@
Ronin


Joined: 19 Feb 2004
Posts: 21

PostPosted: Wed Mar 03, 2004 11:26 pm    Post subject: Re: Crack the Code Reply with quote

:) !!!
Man, this is really funny, let's open up the thread again!


Back to top
Ankou
Spam Mod


Joined: 22 Oct 2004
Posts: 1201
Location: Wisconsin

PostPosted: Thu Mar 04, 2004 4:37 am    Post subject: Re: Crack the Code Reply with quote

The two possible answers are CLAY and CABLE.

I didn't want to post my answers because I actually got a newsletter with the question posted last month ... and then the newsletter with the answers this month.

http://www.state.me.us/newsletter/mar2004/challenge_for_march.htm


Edited to fix the link.

"Love is the blackest of all plagues" -The Seventh Seal

Edited by: Ankou  at: 3/4/04 4:34 pm
Back to top
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Thu Mar 04, 2004 8:36 am    Post subject: Re: Crack the Code Reply with quote

Dan, what are you doing signed up to the State of Maine's technology newsletter?

BTW, that is where I got them from. :)



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Back to top
Ankou
Spam Mod


Joined: 22 Oct 2004
Posts: 1201
Location: Wisconsin

PostPosted: Thu Mar 04, 2004 4:36 pm    Post subject: Re: Crack the Code Reply with quote

I was looking up something one time and came across a page there with some good info. Read over a few more things on the site and thought, "Hey pretty interesting stuff" so I've been going there occassionally to see what's new.

"Love is the blackest of all plagues" -The Seventh Seal

Edited by: Ankou  at: 3/4/04 4:37 pm
Back to top
Eric
Idea Hamster


Joined: 21 Oct 2004
Posts: 679
Location: Bangor, Maine

PostPosted: Fri Mar 05, 2004 12:33 pm    Post subject: Re: Crack the Code Reply with quote

I work for the State of Maine. :)

I haven't subscribed yet... but I will soon.



Eric D. Burdo - RLI Solutions


Sign Up Today for the Programmer's Corner Newsletter
the drop ship guide - The complete guide on to how to get started with wholesale drop shipping.

Back to top
Shaldares
Grasshopper


Joined: 04 Nov 2006
Posts: 19
Location: Everywhere in the Salt Lake Valley, Utah

PostPosted: Tue Oct 21, 2008 4:05 pm    Post subject: Reply with quote

Well, I got bored, so I decided to give this a try, and well, I'm pretty sure it's possible, it would just take a lot of coding, as you would have to calculate the converting down to integers to a lower power for the rest of the letters, and then go through and weed out all of the possibilities. I'm not sure if I'm even going to go that far yet lol. I've started on it and I should have enough code in here to calculate the first possible outcome, however my compiler is pissing me off (it doesn't like how I'm doing my public variables, and I've tried to reformat them several times) so I'm going to take a break from it for a while. This is what I have so far, to give anyone else who's bored some ideas. And I'm sorry, yes, my code looks horrible and I haven't taken the time to document it yet Confused
Oh, a sidenote, this is coded in C++.


Code:
#include <cstdlib>
#include <iostream>

using namespace std;
void decode(int);
int convert(int);
char breakdown(int);
char a;
char b;
char c;
char d;
char e;
char f;
int count;
int code;
int main(int argc, char *argv[])
{
    cout << ("Please enter the numerical code(only integers up to 6 digits.)\n");
    cin >> code;
    if (code>999999)
    {
      cout << ("Invalid number. Terminating program.");
      system("PAUSE");
      return EXIT_SUCCESS;
    }
    else
    {
        if (code>99999)
     {
      count=6;
     }
     else
     {
      if (code>9999)
      {
       count=5;
      }
     }
     else
     {
         if (code>999)
         {
          count=4;
         }
     }
     else
     {
         if (code>99)
         {
          count=3;
         }
     }
     else
     {
         if (code>9)
         {
          count=2;
         }
     else
     {
         if (code>0)
         {
          count=1;
         }
     }
     else count=0;
     cout << ("Possible Answers:\n");
        decode(code);
     cout << f << e << d << c << b <<a>0)
    system("PAUSE");
    return EXIT_SUCCESS;
}

void decode(int code)
{
     int result;
     double decoding;
     if (count>0)
     {
     decode(code);
     switch(code){
     
     case 6:
          result=decoding=convert(code);
          a=breakdown(result);
          break;
     case 5:
          result=decoding=convert(code);
          b=breakdown(result);
          break;
     case 4:
          result=decoding=convert(code);
          c=breakdown(result);
          break;
     case 3:
          result=decoding=convert(code);
          d=breakdown(result);
          break;
     case 2:
          result=decoding=convert(code);
          e=breakdown(result);
          break;
     case 1:
          result=decoding=convert(code);
          f=breakdown(result);
          break;
          }
      return
     }
     
char breakdown(int result)
{
     switch(result){
                         case 1:
                              temp="A";
                              count-=1;
                              code-=1;
                              break;
                         case 2:
                              temp="B";
                              count-=1;
                              code-=2;
                              break;
                         case 3:
                              temp="C";
                              count-=1;
                              code-=3;
                              break;
                         case 4:
                              temp="D";
                              count-=1;
                              code-=4;
                              break;
                         case 5:
                              temp="E";
                              count-=1;
                              code-=5;
                              break;
                         case 6:
                              temp="F";
                              count-=1;
                              code-=6;
                              break;
                         case 7:
                              temp="G";
                              count-=1;
                              code-=7;
                              break;
                         case 8:
                              temp="H";
                              count-=1;
                              code-=8;
                              break;
                         case 9:
                              temp="I";
                              count-=1;
                              code-=9;
                              break;
                         }
     return temp;
}
int convert(int decode)
{
    switch(count)
    {
                 case 1:
                      if (decode<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          decode*=1;
                      }
                      break;
                 case 2:
                      if (decode<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          decode*=0.1;
                      }
                      break;   
                 case 3:
                      if (decode<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          decode*=0.01;
                      }
                      break;   
                 case 4:
                      if (decode<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          decode*=0.001;
                      }
                      break;   
                 case 5:
                      if (decode<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          decode*=0.0001;
                      }
                      break;   
                 case 6:
                      if (code<1)
                      {
                                 decode*=10;
                      }
                      else
                      {
                          code*=0.00001;
                      }
                      break;   
    {
    return decode;
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Code Wars All times are GMT - 5 Hours
Page 1 of 1

 


Powered by phpBB © 2001, 2002 phpBB Group