Programmers: up for a SDN weird code challenge?

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

User avatar
Praxis
Sith Acolyte
Posts: 6012
Joined: 2002-12-22 04:02pm
Contact:

Post by Praxis »

Sounds kinda fun.

I know Java and C, personally.
User avatar
Beowulf
The Patrician
Posts: 10621
Joined: 2002-07-04 01:18am
Location: 32ULV

Post by Beowulf »

I'd need some more direction than just something interesting, I think. I'll think about it.
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan
User avatar
Dooey Jo
Sith Devotee
Posts: 3127
Joined: 2002-08-09 01:09pm
Location: The land beyond the forest; Sweden.
Contact:

Post by Dooey Jo »

I'll see what I can come up with :twisted:
Image
"Nippon ichi, bitches! Boing-boing."
Mai smote the demonic fires of heck...

Faker Ninjas invented ninjitsu
User avatar
Pezzoni
Jedi Knight
Posts: 565
Joined: 2005-08-15 03:03pm

Post by Pezzoni »

Sounds cool (I would personally be using PHP), and currently have some suitible code. Of course, it needs to be finished first.
Miles Teg
Padawan Learner
Posts: 300
Joined: 2002-07-21 06:11pm

Post by Miles Teg »

How about Lisp, or perhaps Prolog? It's hard for me to do anything "wierd" in C++ or Java, but Prolog...it's just fucking wierd to begin with =)

More seriously, I'd be up for that.
Now I am become death -- the shatterer of worlds...
-- Oppenheimer 1945
User avatar
Arrow
Jedi Council Member
Posts: 2283
Joined: 2003-01-12 09:14pm

Post by Arrow »

Miles Teg wrote:How about Lisp, or perhaps Prolog?
May you be buried in flaming cow shit. I HATE Lisp with a passion. If I was stuck in elevator with a Lisp programmer and the guy that tossed shitty underwear on my head in high school, and I had a gun with one bullet, I'd shoot the Lisp programmer.

On topic, like Beowulf I need some direction. I might think of something on my own, but I'm a bit too use to these things called requirements.
Artillery. Its what's for dinner.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Post by phongn »

Arrow wrote:May you be buried in flaming cow shit. I HATE Lisp with a passion. If I was stuck in elevator with a Lisp programmer and the guy that tossed shitty underwear on my head in high school, and I had a gun with one bullet, I'd shoot the Lisp programmer.
You are weak!
User avatar
Arrow
Jedi Council Member
Posts: 2283
Joined: 2003-01-12 09:14pm

Post by Arrow »

phongn wrote:You are weak!
Bah, you try counting parenthesis by hand for a semster! Cheap ass dev environment...
Artillery. Its what's for dinner.
User avatar
Beowulf
The Patrician
Posts: 10621
Joined: 2002-07-04 01:18am
Location: 32ULV

Post by Beowulf »

Arrow wrote:
phongn wrote:You are weak!
Bah, you try counting parenthesis by hand for a semster! Cheap ass dev environment...
Isn't that what indentation is for? :P
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Post by phongn »

Arrow wrote:
phongn wrote:You are weak!
Bah, you try counting parenthesis by hand for a semster! Cheap ass dev environment...
I used jEdit for writing code and then imported it into the Lisp interpreter. But I suppose we could use something like Haskall, ML or F# instead :P
User avatar
Arrow
Jedi Council Member
Posts: 2283
Joined: 2003-01-12 09:14pm

Post by Arrow »

phongn wrote:I used jEdit for writing code and then imported it into the Lisp interpreter. But I suppose we could use something like Haskall, ML or F# instead :P
Ok, my first semster our professor had us use Dr. Scheme, and that worked pretty well. Then a couple of semsters later, we had a new (and incomponent) professor that made us do the projects in class, without any kind of editor (that was beyond her understanding). That, in combination with other bad memories of gross stupidity from that class has turned me off to Lisp.

If we had a shudder emoticon, I'd be using it right now.
Artillery. Its what's for dinner.
User avatar
Prozac the Robert
Jedi Master
Posts: 1327
Joined: 2004-05-05 09:01am
Location: UK

Post by Prozac the Robert »

Since I have no apreciable skill with programing, I'll simply point at this little masterpiece of computer language creation by some more talented people: The Shakespeare Programming Language

Variables are characters, defined like so:
Romeo, a young man of Verona.
Juliet, a young woman.
Hamlet, a temporary variable from Denmark.
The Ghost, a limiting factor (and by a remarkable coincidence also
Hamlet's father).
Operations on variables are carried out as part of a conversation between two characters. GOTOs are implemented by jumping between scenes. Eg:
Juliet:
Art thou more cunning than the Ghost?

Romeo:
If so, let us proceed to scene V.
Take a look at some of the complete example programs, some of them are pretty funny.
Hi! I'm Prozac the Robert!

EBC: "We can categorically state that we will be releasing giant man-eating badgers into the area."
User avatar
Mad
Jedi Council Member
Posts: 1923
Joined: 2002-07-04 01:32am
Location: North Carolina, USA
Contact:

Post by Mad »

I'd be interested. Though I'd prefer some kind of direction as well. Plus that makes things a bit easier to compare when thinking about which one is more interesting. (Interesting in what way? Code complexity? Performance? Coding style?)
Later...
Miles Teg
Padawan Learner
Posts: 300
Joined: 2002-07-21 06:11pm

Post by Miles Teg »

phongn wrote:
Arrow wrote:
phongn wrote:You are weak!
Bah, you try counting parenthesis by hand for a semster! Cheap ass dev environment...
I used jEdit for writing code and then imported it into the Lisp interpreter. But I suppose we could use something like Haskall, ML or F# instead :P
Though jEdit is suitable, it lacks a lot of the integration that Emacs has with Lisp (emacs is written in Lisp). For instance, you can run just about any lisp interpreter directly in Emacs.
Now I am become death -- the shatterer of worlds...
-- Oppenheimer 1945
Miles Teg
Padawan Learner
Posts: 300
Joined: 2002-07-21 06:11pm

Post by Miles Teg »

Arrow wrote:
Miles Teg wrote:How about Lisp, or perhaps Prolog?
May you be buried in flaming cow shit. I HATE Lisp with a passion. If I was stuck in elevator with a Lisp programmer and the guy that tossed shitty underwear on my head in high school, and I had a gun with one bullet, I'd shoot the Lisp programmer.

On topic, like Beowulf I need some direction. I might think of something on my own, but I'm a bit too use to these things called requirements.

hahahah.. I was about to say the similar things about the guy who suggested PHP... The only thing I can think of that is worse is Python....

Miles Teg
Now I am become death -- the shatterer of worlds...
-- Oppenheimer 1945
User avatar
Arrow
Jedi Council Member
Posts: 2283
Joined: 2003-01-12 09:14pm

Post by Arrow »

Miles Teg wrote:hahahah.. I was about to say the similar things about the guy who suggested PHP... The only thing I can think of that is worse is Python....

Miles Teg
Or a FORTRAN program written with job security in mind. Obtuse and excessive common block masking is next to impossible to figure out.
Artillery. Its what's for dinner.
User avatar
The Aliens
Keeper of the Lore
Posts: 1482
Joined: 2003-12-29 07:28pm
Location: hovering high up above, making home movies for the folks back home.
Contact:

Post by The Aliens »

I suppose Turing doesn't count? :P
| Lorekeeper | EBC |
| SEGNOR | Knights |

..French....................Music..................
|::::::::|::::::::|::::::::|::::::::|
.................Comics...................Fiction..
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Post by phongn »

Miles Teg wrote:Though jEdit is suitable, it lacks a lot of the integration that Emacs has with Lisp (emacs is written in Lisp). For instance, you can run just about any lisp interpreter directly in Emacs.
I didn't feel like learning a wholly new operating system for a few weeks of Lisp :P
Miles Teg wrote:hahahah.. I was about to say the similar things about the guy who suggested PHP... The only thing I can think of that is worse is Python....
Hey now, what's with the Python hate? I can agree with PHP - I currently do some development in ASP.NET/C#.
User avatar
Dooey Jo
Sith Devotee
Posts: 3127
Joined: 2002-08-09 01:09pm
Location: The land beyond the forest; Sweden.
Contact:

Post by Dooey Jo »

What's wrong with PHP?
Image
"Nippon ichi, bitches! Boing-boing."
Mai smote the demonic fires of heck...

Faker Ninjas invented ninjitsu
User avatar
Dooey Jo
Sith Devotee
Posts: 3127
Joined: 2002-08-09 01:09pm
Location: The land beyond the forest; Sweden.
Contact:

Post by Dooey Jo »

Well here's something... interesting I threw together.

Code: Select all

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>

class CMystery {
    std::string m_likeStr;
    std::string m_vowels;
    std::string m_consonants;
    std::vector<std::string> m_mysteryWords;
    public:
        CMystery() {
            m_likeStr = "abcdefghijklmnopqrstuvwxyz";
            m_vowels = "aeiouy";
            m_consonants = "bdfghjklmnpqrstvwxyz";
            m_mysteryWords.push_back("ise");
            m_mysteryWords.push_back("er");
            m_mysteryWords.push_back("es");
            m_mysteryWords.push_back("ing");
            m_mysteryWords.push_back("able");
            m_mysteryWords.push_back("ard");
            m_mysteryWords.push_back("ate");
            m_mysteryWords.push_back("ery");
            m_mysteryWords.push_back("ian");
            m_mysteryWords.push_back("oid");
            m_mysteryWords.push_back("us");
            m_mysteryWords.push_back("ily");
            m_mysteryWords.push_back("ern");
            m_mysteryWords.push_back("ish");
        }
    
        std::string Babblise(const std::string &str) {
            if (str.size() == 0) return "I see what you did there.";
        
            std::string lStr = str;
            int (*pf)(int)=tolower; 
            std::transform(lStr.begin(),lStr.end(), lStr.begin(), pf); 
            std::vector<std::string> words;
            
            std::istringstream is(lStr);
            std::string tStr;
            while ((is >> tStr) && (tStr != "")) {
                std::string addStr;
                for (int i=0; i<tStr.size(); ++i) {
                    if (m_likeStr.find(tStr[i]) != std::string::npos)
                         addStr += tStr[i];
                }
                if (addStr != "")
                    words.push_back(addStr);
            }
            
            std::string writeStr;
            while (words.size() > 0) {
                unsigned int i = rand()%words.size();
                writeStr += words[i];
                
                unsigned int testes = m_mysteryWords.size()<<1;
                unsigned int index = rand() % testes;
                if (index < m_mysteryWords.size()) {
                    if (m_vowels.find(words[i].at(words[i].size()-1)) != std::string::npos)
                        writeStr += m_consonants[rand()%m_consonants.size()];
                    writeStr += m_mysteryWords[index];
                }
                
                if (words.size() != 1) writeStr += " ";
                else writeStr += ".";
                std::vector<std::string>::iterator it = words.begin() + i;
                words.erase(it);
            }
            
            if (writeStr.size() > 0)
                writeStr[0] = toupper(writeStr[0]);
            
            return writeStr;
        }
};

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(0));
    cout << "Dooey's can o' worms!!\n\nWrite something fancy!\n\n";
    
    CMystery omfg;
    
    string inStr;
    while (getline(cin,inStr)) {
        if (inStr == "exit" || inStr == "no" || inStr == "I don't wanna!")
            break;
        cout << endl << "You wrote " << "\"" << inStr << "\"\n"
        << "I write: " << omfg.Babblise(inStr) << "\n"
        << "Write something more!\n\n";
    }
    
    return 0;
}

It weirdifies sentences that you type into it, turning them into gibberish.
Image
"Nippon ichi, bitches! Boing-boing."
Mai smote the demonic fires of heck...

Faker Ninjas invented ninjitsu
User avatar
Ace Pace
Hardware Lover
Posts: 8456
Joined: 2002-07-07 03:04am
Location: Wasting time instead of money
Contact:

Post by Ace Pace »

Is it reversable?
Brotherhood of the Bear | HAB | Mess | SDnet archivist |
User avatar
Prozac the Robert
Jedi Master
Posts: 1327
Joined: 2004-05-05 09:01am
Location: UK

Post by Prozac the Robert »

Dooey Jo wrote: It weirdifies sentences that you type into it, turning them into gibberish.
I like. I quite like the way it stops if you type no in as well.
Hi! I'm Prozac the Robert!

EBC: "We can categorically state that we will be releasing giant man-eating badgers into the area."
User avatar
Bounty
Emperor's Hand
Posts: 10767
Joined: 2005-01-20 08:33am
Location: Belgium

Post by Bounty »

I can't really code but I try :)

Code: Select all

++++++++++
[>+++++++>++++++++++>+++>+>++++++++<<<<<-]
>++.
>+.
+++++++.
.
+++.
>++.
>>+++.
<<<<----.
>>>>-----.
<<.
+.
>.
A cookie if you recognise it, two if you know what it says. Yes, you can compile it.
User avatar
Dahak
Emperor's Hand
Posts: 7292
Joined: 2002-10-29 12:08pm
Location: Admiralty House, Landing, Manticore
Contact:

Post by Dahak »

Bounty wrote:I can't really code but I try :)

Code: Select all

++++++++++
[>+++++++>++++++++++>+++>+>++++++++<<<<<-]
>++.
>+.
+++++++.
.
+++.
>++.
>>+++.
<<<<----.
>>>>-----.
<<.
+.
>.
A cookie if you recognise it, two if you know what it says. Yes, you can compile it.
...Brainfuck?
Though I'd have to look into it to know what it means :)
Image
Great Dolphin Conspiracy - Chatter box
"Implications: we have been intercepted deliberately by a means unknown, for a purpose unknown, and transferred to a place unknown by a form of intelligence unknown. Apart from the unknown, everything is obvious." ZORAC
GALE Force Euro Wimp
Human dignity shall be inviolable. To respect and protect it shall be the duty of all state authority.
Image
User avatar
Bounty
Emperor's Hand
Posts: 10767
Joined: 2005-01-20 08:33am
Location: Belgium

Post by Bounty »

...Brainfuck?
We have a winner ! Now for the other cookie...
Post Reply