Page 1 of 12 12345611 ... LastLast
Results 1 to 10 of 113

Thread: Counting

  1. #1
    Ceann na Drochaide Bige! XcOM's Avatar
    Join Date
    Mar 2006
    Location
    Sheffield (UK)
    Posts
    2,990

    Default Counting


    Welcome, this is a challange for the coders here, The idea is to write a program that will count to the number in the section you are entering in.

    The rules are as follows:
    * No one is to share there code
    * No one is to copy anyone else's program
    * You are to write your program yourself but you may get help from friends.

    The sections are:
    * Visual Basic
    - 1 Million
    - 2 Million
    - 5 Million
    - 10 Million
    - 100 Million

    * C & C++
    - 1 Million
    - 2 Million
    - 5 Million
    - 10 Million
    - 100 Million

    * Other languages
    - 1 Million
    - 2 Million
    - 5 Million
    - 10 Million
    - 100 Million

    *your program must make a record of the numbers it counts, wether it displays this or saves a document it is upto you.

    To enter make your program and e-mail myself at tbcscomp@gmail.com with your program compiled into an EXE and the source code so i can verify your entry.

    I will compile a results table for each section after the compition has ended (19th,Apr,2008 ) and a winner announced.

    All programs will be run on my test system to get an accurate result after the comp has ended, a winner will be announced within one week of ending.
    And the most important part, Have fun.
    Last edited by XcOM; 04-07-2008 at 03:43 PM.


    Mary had a little lamb. It bumped into a pylon. Ten thousand volts went up its arse and turned its wool to nylon!

  2. #2
    Carpe Apenodytes halcyonforever's Avatar
    Join Date
    Mar 2008
    Location
    Oklahoma
    Posts
    260

    Default Re: Counting

    Questions for this competition:
    • Purpose: Is the goal to write the most elegant code, the spiffiest program, or the fastest running.
    • Hardware: are we limited in our usage of equiptment. (ie: one computer only or can we botnet a whole company in a distributed computing super-cluster)

  3. #3
    Ceann na Drochaide Bige! XcOM's Avatar
    Join Date
    Mar 2006
    Location
    Sheffield (UK)
    Posts
    2,990

    Default Re: Counting

    the purpose is to count to the target as fast as possable, and as for hardware the tables i produce will be for desktops/laptops and one for special pc's IE Clusters

    My records sofar are:
    1million: 8 seconds
    2million: 12 seconds
    5million: 26 seconds
    10million: 56 seconds
    and 1 billion is still running after 1 hour, and is currently writting a file sitting at 8.2GB sofar, but i don't know what number it is upto as i have my program set to ignore everything but counting.

    Also mine is coded in VB6, i got to find a way to use dual cores.


    Mary had a little lamb. It bumped into a pylon. Ten thousand volts went up its arse and turned its wool to nylon!

  4. #4
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    XcOM, did you get this Idea from me? Haha, I will start work immediately.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  5. #5
    Fox Furry crenn's Avatar
    Join Date
    Apr 2005
    Location
    In the shadows behind you
    Posts
    4,067

    Default Re: Counting

    Why do I have a feeling I'm going to have to learn multithreading now.....

    Should I take a link down to my C code which counts (doesn't store to a file though)?

    EDIT: Also does the version of C/C++ use matter?
    Antec Sonata II | Pioneer DVR-212
    Good news! You can follow my website or follow me on twitter!

  6. #6
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    Well, My program just told me it took 3.625 Seconds to count to 1 million
    Programmed in VB6

    This is WITHOUT multi threading

    From the values below, you can see it is almost linear relationship between which number you count to and how long it takes. In fact, you will notice that if you multiply the 100 Million time by 5 it is actually longer then what 500 Million took.

    System specs: 2.3 GHz Athlon 64 X2

    My Records
    1 Million: 3.406 Seconds
    2 Million: 7.047 Seconds
    5 Million: 17.906 Seconds
    10 Million: 34.562 Seconds
    100 Million: 394.563 Seconds
    500 Million: 1887.578 Seconds
    1 Billion: 3732.39 Seconds = 62.2 Minutes 12GB file
    Last edited by Trace; 04-04-2008 at 08:39 PM. Reason: Added an analysis
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  7. #7

    Default Re: Counting

    Who wants a headache?

    This is a slight violation of the rules, but I don't think too many people are going to benefit from it.
    My program counts from 0 to 1,000,000 in roughly .5 seconds, while storing these values into a .txt file

    my code, for anyone who dares:
    Code:
    import java.util.*;
    import java.io.*;
    import java.lang.management.*;
    class ${int _;char O=(char)0X0A;boolean $=!(1!=0%1);String __$=""+'$';
    char O(int x){return(char)(x*83+32);}char O1(int x){return(char)((x<<1)+99);}
    char l0(int x){return(char)(x+100);}int l01(int y){return(y==1?10:10*l01(--y));}
    public static void main(String args[])throws Exception{new $();}$()throws Exception{
    long $_=$_();toilet=$$();_%=1;for(;!$;)_();
    
    toilet.flush(); //always a must
    
    _$_(($_()-$_)*.01/(15^5)/(117&(55<<1))/(64|36)/(11^111)
    +""+O(0)+O(1)+O1(1)+O1(0)+l0(11)+l0(10)+l0(0)+O(1)+O);}
    void _()throws Exception{toilet.write(_+""+O);++_;$=(_>l01(6));}
    long $_(){return t.getCurrentThreadCpuTime();}
    void _$_(Object x){__().print(x);}
    PrintStream __(){return System.out;}
    BufferedWriter $$()throws Exception{return new BufferedWriter(new FileWriter(__$));}
    ThreadMXBean t=ManagementFactory.getThreadMXBean();
    BufferedWriter toilet;}
    And yes, it is syntactically correct, compiles, and does what it is described as doing.

    To run it, just copy the code into a file called $.java, then compile it, and run it. This will output the time taken, and the numbers will be in a new file which it creates.

    Have fun
    I'm not creative enough to think of a funny sig. Just quietly laugh to yourself and I'll be happy.

  8. #8
    Overclocking Guru Trace's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    2,077

    Default Re: Counting

    Well, I'm not going to even touch that.
    I would really like to learn Java though. I'm currently working on that actually.
    Quote Originally Posted by Lothair View Post
    I guess it's just widely used and has had some of the best people in the world work on it, costing a ridiculous amount of money, for no actual reason. :/
    Have you checked out the front page lately?
    Projects:
    Moe's Tavern | Sponsored by: Mimo Monitors, Crucial, Thermaltake
    Book Of Knowledge

  9. #9
    Fox Furry crenn's Avatar
    Join Date
    Apr 2005
    Location
    In the shadows behind you
    Posts
    4,067

    Default Re: Counting

    Java gives me a headache... most likely because I don't know how to program it.

    Currently I'm holding off this comp because of the fact I need to complete my C assignment. If you want the source code of the program(for my assignment) I'm working on, I'll be happy to share it after Friday 5PM (last day it's due). Just PM me asking for it.
    Antec Sonata II | Pioneer DVR-212
    Good news! You can follow my website or follow me on twitter!

  10. #10
    Linux dabbler IndyRacer27's Avatar
    Join Date
    Apr 2007
    Location
    Northern Canada
    Posts
    253

    Default Re: Counting

    weazel6265, yes definitely gave me headache. Have you ever heard of the International Obfuscated C Code Contest and here? Your program reminded me of it. The fact that you came up with that is pretty impressive. I'm guessing you're not just a hobby programmer.
    My goal in life is to earn enough money to enjoy the lifestyle that my wife and kids do.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •