Thread: Lets have a little competition

  1. #1
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687

    Lets have a little competition

    I've just finished writing a genetic algorithm for Hello World, would anyone be interested in having a race? All languages allowed and no time limit.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by ಠ_ಠ View Post
    I've just finished writing a genetic algorithm for Hello World, would anyone be interested in having a race? All languages allowed and no time limit.
    Oh my, how cute... he's written his first program!

    (and it's "generic" not "genetic" ... look it up.)
    Last edited by CommonTater; 04-22-2011 at 10:04 PM.

  3. #3
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by CommonTater View Post
    Oh my, how cute... he's written his first program!

    (and it's "generic" not "genetic" ... look it up.)
    You almost had me with that one
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    I'm having a hard time figuring out why we would want either a genetic algorithm or a generic algorithm for Hello World.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by laserlight View Post
    I'm having a hard time figuring out why we would want either a genetic algorithm or a generic algorithm for Hello World.
    for fun?
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by laserlight View Post
    I'm having a hard time figuring out why we would want either a genetic algorithm or a generic algorithm for Hello World.
    So they can breed more successfully. Like love, there is not enough Hello World in the universe.

    Would a device driver be acceptable?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    Quote Originally Posted by CommonTater View Post
    Oh my, how cute... he's written his first program!

    (and it's "generic" not "genetic" ... look it up.)
    Everybody Love Everybody.

    (I realise you're not unprovoked, but be the better man...be the better man.)

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by DeadPlanet View Post
    (I realise you're not unprovoked, but be the better man...be the better man.)
    Sometimes the little twit is just too silly to resist...

  9. #9
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Quote Originally Posted by laserlight View Post
    I'm having a hard time figuring out why we would want either a genetic algorithm or a generic algorithm for Hello World.
    That's what I'm trying to figure out.

    Also, what kind of implementation is this?
    Are you thinking down the lines of
    Code:
    #define dna_len strlen("Hello, world!");
    ?

  10. #10
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Yarin View Post
    That's what I'm trying to figure out.

    Also, what kind of implementation is this?
    Are you thinking down the lines of
    Code:
    #define dna_len strlen("Hello, world!");
    ?
    pretty much, yeah

    as to why we'd want to do this, it provides an entrance to genetic algorithms where it's easy to evaluate your success, and there is plenty of room for optimization depending on how you choose to calculate your fitness, perform crossovers, or select members for the next generation. Oh, and it's fun imo
    Last edited by ಠ_ಠ; 04-23-2011 at 06:23 PM.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by ಠ_ಠ View Post
    Quote Originally Posted by Yarin View Post
    That's what I'm trying to figure out.

    Also, what kind of implementation is this?
    Are you thinking down the lines of
    Code:
    #define dna_len strlen("Hello, world!");
    ?
    pretty much, yeah

    as to why we'd want to do this, it provides an entrance to genetic algorithms where it's easy to evaluate your success, and there is plenty of room for optimization depending on how you choose to calculate your fitness, perform crossovers, or select members for the next generation. Oh, and it's fun imo
    Okay, there is my submission with extensive comments and acknowledgements. Cheers, and thanks, to the fellow OSS developers!
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  12. #12
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    I like this idea, actually.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  13. #13
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by MK27 View Post
    Okay, there is my submission with extensive comments and acknowledgements. Cheers, and thanks, to the fellow OSS developers!
    Wow, that's a really impressive runtime.

    Here's mine, written in Java https://sourceforge.net/projects/helloworldga/files/
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  14. #14
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Code:
    #warning Hello World
    Mine is printed before yours is even compiled. I win.

    Also:
    Code:
    
    ?- write('Hello world!'), nl.
    because Prolog is awesome.

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Cut n' paste #2: "name this language" challenge

    Code:
    +++++ +++++             initialize counter (cell #0) to 10
    [                       use loop to set the next four cells to 70/100/30/10
        > +++++ ++              add  7 to cell #1
        > +++++ ++++++           add 11 to cell #2 
        > +++                   add  3 to cell #3
        > +                     add  1 to cell #4
        <<<< -                  decrement counter (cell #0)
    ]                   
    > ++ .                  print 'H'
    > + .                   print 'e'
    +++ ++ .              print 'l'
    .                       print 'l'
    +++ .                   print 'o'
    > ++ .                  print ' '
    << +++++ +++++ +++++ .  print 'W'
    > .                     print 'o'
    +++ .                   print 'r'
    ----- - .               print 'l'
    ----- --- .             print 'd'
    > + .                   print '!'
    > .                     print '\n'
    bonus points if you have a compiler for this "mystery" language and can find the typo(s)...
    Last edited by MK27; 04-26-2011 at 07:35 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorry, lets try again(C++ Help)
    By SNTRL in forum C++ Programming
    Replies: 6
    Last Post: 09-10-2010, 12:56 AM
  2. Case Competition Help !
    By kashahyah in forum C Programming
    Replies: 10
    Last Post: 04-10-2008, 10:19 AM
  3. Competition
    By siavoshkc in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-21-2006, 02:30 PM
  4. Competition?
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 40
    Last Post: 09-14-2001, 08:58 AM