ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Make it Small Challenge 1 (Time Output)

August 12, 2008 3:05am

Subscribe [7]
  • #31 / Aug 13, 2008 3:05pm

    James Gifford

    77 posts

    Another solution (inspired by m4rw3r’s last solution):

    function times ()
    {
        while ($i < 96)
            $a[] = gmdate('h:iA', $i++*900);
        return $a;
    }
  • #32 / Aug 13, 2008 3:16pm

    m4rw3r

    647 posts

    Mine is fasteeer!!!! 😊

    Nice one, James, 6 characters shorter (counting like I counted mine).
    15% slower than mine, and 15% shorter 😛

  • #33 / Aug 13, 2008 4:51pm

    James Gifford

    77 posts

    Mine is fasteeer!!!! 😊

    Yes, but that’s not the goal of this challenge is it?  😊

    Seriously though, your solution is the most efficient so far with one loop, one function call, and one calculation. Mine has two calculations plus it uses a while loop which I think might be less efficient than a for loop for a known number of loops.

  • #34 / Aug 13, 2008 7:50pm

    Sally D

    129 posts

    from the looks of it I thought James won, cause his code was so compact and fast.

    but I was thinking of another challenge how about this lets take the 26 letters of the alphabet and then scramble them up and then from those mixed up letters we would have to produce the sentence:

    “Codeignter helps you write kick ass php programs”

    and the one whose code is the most concise and fast wins. We should make a coding Olympics section to this forum?

    Here are some sets

    String[] = ’ a-z’ // randomized
    function return_string($randomized_alphabet) {
    // code to take those randomized letters and then make return the said string
    }

    the shortest code wins

    No that’s stupid man it would require to much code but I do like the idea about a coding Olympics

  • #35 / Aug 14, 2008 8:21am

    Lone

    350 posts

    My real aims with these challenges is for them to be suitable for real world requirements - making the world a better (faster) place 😛

  • #36 / Aug 27, 2008 5:41pm

    MichaelMe

    1 posts

    My real aims with these challenges is for them to be suitable for real world requirements - making the world a better (faster) place 😛

    Couldya help a newbie out then, and tell me how i might use one of these to populate a select box? Cuz i need to do that in the real world.

    Thanks,
    Mike

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases