Thread: ADC #1 Results

  1. #16
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    [nitpick]
    the original posting claimed scoring on only:
    Speed: Pedal to the metal
    Elegance: Nifty algorithms are always good
    for the advanced
    [/nitpick]
    granted, my score stunk anyway cause I was too hasty in submitting it.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Prelude, would you mind looking at the above and verifying that?
    It works nicely for my tests, but still doesn't beat my function in speed. Much better though. I'm sure you'll admit that the task was deceptively simple? Beware tricks with me, I'm sneaky.

    >the original posting claimed scoring on only:
    I know. I gave out those scorings before I had a chance to grade an entry. Usually the ADC will score on the four categories that I did unless stated otherwise. And the first one doesn't count for the stated otherwise rule because I had no clue what I was doing until after it was over. Expect a less chaotic contest next time. BTW, next time should be tonight or tomorrow if I can manage it.
    My best code is written with the delete key.

  3. #18
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    ok, I eagerly await the next one. I'll have to pay more attention to portability in the future as well. Unfortunately, in my job windows-only development is the norm.

    edit: oh, and I'll spend more than 5 minutes verifying this one
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #19
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I'll have to pay more attention to portability in the future as well.
    I take portability very seriously. Even if your job doesn't require it, you should still be aware of what can be used everywhere and what cannot. May I suggest investing in a good lint?
    My best code is written with the delete key.

  5. #20
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Looks good, my only complaint is that my stick solution was listed as beginner and not intermediate in both my critique and the standings at the top.

    Thanks Prelude, excellent job on the first contest!

  6. #21
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    Well that static array in your advanced submission is great for speed but not multithreading (what I use a lot). And the function prototype you gave us read 'char' in both the parameter and the return type. So we assumed the function will only handle chars, not wchar_t or anything like that.

  7. #22
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Nice job Prelude, you've obviously put a lot of effort into this, so... thanks

    My nitpick (everyone is allowed one, right?), is this:
    Beginner Contest Rules:
    Your function should work for every valid int from INT_MAX to INT_MIN.
    Hammer used the divide and conquer () algorithm that most everyone seemed to prefer for this task. The only real difference is that he took into account the sign as well. This wasn't a requirement, but it's still a nice gesture.
    The sign was a requirement, and if your code didn't cater for it, it'd be wrong (imho). But hey, its only for fun
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #23
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >The sign was a requirement, and if your code didn't cater for it, it'd be wrong (imho).
    I meant that I didn't specify how it was to be dealt with. I didn't say to remove it, did I?
    My best code is written with the delete key.

  9. #24
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    Hey Prelude, Lucifuri0us was me. I put a comment at the top of the code, but I guess it wasnt so obvious.

    >I chose the obvious solution because the not so obvious solution was dreadfully slow. Both produced correct output

    Hmmm. The not so obvious solution is slower in general, but if the string was, say, 100 million characters, the not so obvious one would have been much faster since it only iterated through the string once. Shouldnt I have gotten credit for originality?

    Thanks for all the effort you put into this contest.
    C Code. C Code Run. Run Code Run... Please!

    "Love is like a blackhole, you fall into it... then you get ripped apart"

  10. #25
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    One question...

    Let's say I have
    Code:
    int main() {
      char stuff[33001];
      memset(stuff,0,33000*sizeof(char));
      //...
      return 0;
    }
    Would that get optimized into:
    Code:
    int main() {
      char stuff[33001] = { 0,0,0,0, .....  ,0 };
      //...
      return0;
    }
    by the compiler?

  11. #26
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    wow.. this was a contest... Great reviews..
    Sorry for the unnecessary commenting.. Picked that up in high school where our teachers insited we comment each line... sorry..


    And some suggestions
    -----------------------------

    How about the contst page having daily stastics.. Like number of people etc etc with score grade etc and some kind of ranking system. which would be carried on throughout the contest..

  12. #27
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by ygfperson
    One question...

    Let's say I have
    Code:
    int main() {
      char stuff[33001];
      memset(stuff,0,33000*sizeof(char));
      //...
      return 0;
    }
    Would that get optimized into:
    Code:
    int main() {
      char stuff[33001] = { 0,0,0,0, .....  ,0 };
      //...
      return0;
    }
    by the compiler?
    How a compiler converts syntax varies between different compilers......but if memset was implemented as a function, you would see a call (assuming 0x86).....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 72hour GDC Results
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 07-05-2004, 11:46 PM
  2. ADC #4 Results
    By Prelude in forum Contests Board
    Replies: 9
    Last Post: 08-28-2003, 01:38 PM
  3. ADC #3 Results
    By Prelude in forum Contests Board
    Replies: 19
    Last Post: 08-18-2003, 11:25 PM
  4. ADC #2 Results
    By Prelude in forum Contests Board
    Replies: 20
    Last Post: 08-11-2003, 06:59 AM
  5. Same seed for srand yields different results
    By codegirl in forum C++ Programming
    Replies: 3
    Last Post: 06-23-2003, 02:39 PM