Thread: brilliant code

  1. #31
    Registered User
    Join Date
    Aug 2001
    Posts
    244
    I'm rather proud of my Sieve of Eratosthenes and my matrix class (which can multiply matrices, find the inverse and determinant of ANY size matrices, and more to come), but I'd hardly consider either brilliant..

  2. #32
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Originally posted by Prelude
    Most brilliant code? How about the worlds smallest program:
    Code:
    
    
    Unfortunately, it's not 100% portable.

    -Prelude

    WHAHAHAHAHAHA - and now I've got the source code!! It's ALL MINE!!!!
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #33
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by Aran Elus
    first we must differentiate between clever code and brilliant code.
    Simple,
    Clever: skillful or adroit in using the hands or body
    mentally quick and resourceful but often lacking in depth and soundness
    Brilliant: distinguished by unusual mental keenness or alertness
    very bright

  4. #34
    Registered User
    Join Date
    Aug 2001
    Posts
    403
    All my brilliant code is written in languages that haven't even been invented yet.. showing just how brilliant it is. I'd post it but I'm pretty sure that'd lead to some sort of tear in space-time which would annihilate us all, that and they characters used to type it aren't available in this primitive textbox.

  5. #35
    Registered User zahid's Avatar
    Join Date
    Aug 2001
    Posts
    531
    Hmm,
    Perfect timing.. I'm at the end of a DBMS for C application.
    It's 2104 lines. Wish within 2500 I can cover.

    It has recovery from crash and dfregmentation. With hours I can ready for any DB. Its 100% portable. Though I'm using for Linux.

    Needs little more review on recovery.

    Once my brilliant code was
    Code:
    void main()
    {
    int a = 10, b=5;
    printf("a=%d, b=%d\n", a, b);
    a +=b;
    b = a-b;
    a -=b;
    printf("a=%d, b=%d\n", a, b);
    }
    ohh.. another one, I was surprised after solving the Tower of Hanoi problem. Tough problem (in that time) but very short code.
    Last edited by zahid; 11-26-2002 at 05:56 AM.
    [ Never code before desk work ]
    -------------------------------------:-->
    A man who fears Nothing is the man who Loves Nothing
    If you Love Nothing, what joy is there in your life.
    =------------------------------------------------------= - I may be wrong.

  6. #36
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Code:
    Hmm,
    Perfect timing.. I'm at the end of a DBMS for C application.
    It's 2104 lines. Wish within 2500 I can cover.
    
    It has recovery from crash and dfregmentation. With hours I can ready for any DB. Its 100% portable. Though I'm using for Linux.

    That is impressive.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM