Page 3 of 3 FirstFirst 123
Results 31 to 32 of 32

Thread: Who fancies a code challenge just for fun?

  1. #31
    Join Date
    Jan 2005
    Alicante (Spain)
    Quote Originally Posted by NogDog View Post
    it's a bit more subjective as to which is simpler to achieve:
    PHP Code:
    $result serialize(count_chars($word1));

    // versus

    $letters str_split($word);
    $result implode(''$letters); 
    If sort returned the array the code would look even simpler. Don't really understand why this function is by reference. Anyway I was thinking about the size of the DB more than anything else.

    Also the scrabble thing needs to output a group of words for each intersection. So 7 tiles + a, through to z, and then we could find places on the board the letters could be useful.

  2. #32
    Join Date
    Aug 2004
    Right now I'd probably vote for your suggestion of just sorting the letters and storing them as being a more optimal solution, since the code that populates the DB is a one-shot deal that does not need to be particularly optimized. However, the slight gain in disk space would generally be of negligible importance in today's world of terabyte disks, so I'm not going to worry enough about it now to change an existing system that works.

    It's probably a good example on how we all can get fixated on a given technology and then apply it without considering if it's really the best solution for a given problem. (Anyone besides me old enough to remember when the US DoD decided all software should be written in Ada?)
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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