PHP Programming Contest - Win Zend Studio

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

zend_studio_box_gif.gif

How would you like a shiny copy of Zend Studio of your own? Well the nice people over at Zend have given me a Zend Studio Professional license to give away as part of a programming contest.

It has been a lot harder than I thought to come up with a fair programming challenge that would not take too long or require lots of knowledge in any particular framework or other associated technology. It could have been to make use of a whole host of currently available API’s and to make a useful mash-up but these again require other external knowledge beyond just PHP. I finally settled on a logic problem that is hopefully not too hard to solve but will test a range of PHP skills.

Prize List

The problem

Many years ago there used to be a UK television quiz show (I am sure there has probably been many versions in other countries) that required the contestants to transform one word into another one letter at a time. The only rule was that each letter change must also result in a real word. Here is an example.

  • Hand
  • Band Changed ‘H’ to ‘B’
  • Bond Changed ‘A’ to ‘O’
  • Fond Changed ‘B’ to ‘F’
  • Food Changed ‘N’ to ‘O’
  • Foot Changed ‘D’ to ‘T’

The challenge is to create a website that the user may supply an arbitrary list of words which makes up a limited dictionary plus a start and an end word. The website must then attempt to create the shortest path between the two words following the rule that each single letter change results in a word within the dictionary.

Requirements

The user must be able to specify the source for valid words, the start and an end word, and the site must display the results on a page containing the following.

  1. Formatted output that contains the steps required to move from the start to the end word.
  2. Any errors that may result from the problem not being solvable.
  3. A link back to the entry page to try a different set of words.

Judging will be based upon

  1. That the code works
  2. Does not produce any errors/warnings/notices.
  3. Efficiency and elegance of the solution.
  4. Robustness
  5. Maintainability

Rules

  1. The code must be all your own work and must not have been published previously.
  2. The code must be received at competition@assembleron.com by 5pm GMT 1st July 2007
  3. Submissions must be in ZIP format including all code required for us to try them.
  4. The submission should include your name and details of your blog if you wish it be publicized. (email addresses will not be made public)
  5. The code must be compatible with either PHP 5.2.3 or PHP 4.4.7 (please specify within your submission if you only support PHP 4)
  6. Code must run where extracted as is with no server modifications required
  7. If your project requires a particular framework please include the framework within your ZIP as part of your project structure. We will reject submissions with any external requirements.
  8. Any required .htaccess files must also be included within the .ZIP
  9. Supplied files include a index.php which is the entry point to project (unless otherwise overridden by .htaccess setup)
  10. If you wish to use MySQL then your application must create the required database/tables as part of a web based specified installation process.
  11. The email you use to submit the entry will be the email we will use to contact you in the event of you winning.
  12. You agree that Assembleron Ltd may publicize your name, likeness, and the source code of your work. Apart from the prize associated with being selected as a winner, Assembleron Ltd shall not be obligated to compensate you in any way for such publicity.
  13. Each entrant shall indemnify, defend, and hold Assembleron Ltd harmless from any third party claims arising from or related to that entrant’s participation in the Contest. In no event shall Assembleron Ltd be liable to an entrant for acts or omissions arising out of or related to the Contest or that entrant’s participation in the Contest.
  14. Full details of the competition results will be posted on this site within 1 week of the competition closing date.

Server Setup

Below are the pertinent sections of the PHP.INI file for our test server that the entries will be tested upon.

PHP (both 4 + 5)

post_max_size = 8M
file_uploads = On
upload_max_filesize = 8M
memory_limit = 64M
error_reporting = E_ALL
display_errors = On

PHP 5

extension=php_mbstring.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_sqlite.dll
extension=php_pdo_mysql.dll
extension=php_sqlite.dll
extension=php_domxml.dll

PHP 4

extension=php_mbstring.dll
extension=php_curl.dll
extension=php_domxml.dll
extension=php_gd2.dll

The full PHP.INI files are here to download if required.

Browser Setup

The testing will be performed using Firefox 2.0.0.4 and IE 7.

Judging Team

To make things fair I will not be the only person judging the competition. The following bloggers will also be judging your projects.

  • Douglas Karr - Doug runs a very successful technology and marketing blog and also writes popular WordPress plugins. Doug will be looking at presentation and ease of use of the projects.
  • Stuart Dallas - Stuart is an active member of the PHP mailing lists and a very experienced PHP programmer. Stuart will be pulling your code apart and examining it in fine detail to see what makes it tick.
  • Cal Evans - Cal is the Editor over at Zend Developer Zone and has been programming PHP for 7 years.

Example words

While you are developing your project you may wish to use this selection of test words. Download here.

If you have questions please use the comment facility at the end of the page. And finally good luck to everyone I look forward to seeing everyones entries.

There Are 46 Responses So Far. »

  1. […] Halstead has invited me to be a judge for a PHP competition he’s running on his blog. Zend have donated some prizes for it, including a copy […]

  2. […] Halstead has announced a contest on his blog today for PHP developers everywhere to participate in - a programming competition […]

  3. Will the server the project needs to run on include aspell or something similar?

  4. GNU Aspell is not included. But you could (and in fact we encourage) you to use PHP to connect to any external web service such as an online dictionary.

  5. HI,

    Just to make sure I am clear on this.

    Does the app need to have a built in dictionary?

    Or, must the user supply all the intermediate words, with some possibly seed fake ones?

    Thanks,

    Leonard

  6. Hi Leonard,

    There is no requirement that you have to use a built in (or extern) dictionary of any sort. But extending the application to make use of an external dictionary to validate the user supplied words is perfectly acceptable (and in fact encouraged).

    Hope this helps

  7. “The code must be all your own work and must not have been published previously.”

    Does that exclude any framework or libraries?

    For example will you accept a entry that will use Zend Framework, protoptype.js and some free 3rd party css template?

  8. You may use a PHP framework (Zend, Symphony, Cake, other..) but as it states in Rule 7 - please include the framework within the ZIP when you send it. You may also use any javascript framework.

  9. Very cool & fun concept.

    A couple questions:

    1) What’s the minimum and maximum word length?

    2) Who owns the rights to the code? And will the winning code be released?

  10. The longest english word according to wikipedia is ‘pneumonoultramicroscopicsilicovolcanoconiosis’ (I dare you to pronounce that!) But seriously I do not think you need put any arbitrary limitations on the word length as long as it is a real word (english or otherwise.)

    You still own the rights to the code but you agree to the fact that I may publish it on this blog. (Rule 12)

  11. I wonder what will be better: a depth-first search, or a depth-first search…

    Would my entry score more points if I provide several algorithms at once?

  12. Damn, I meant “depth-first search, or breadth-first search”

  13. Is the “php_value” keyword supported in your .htaccess implementation? I’d like to override the auto_prepend_file directive.

  14. […] full details, head over to Nicholas’ site! Good […]

  15. the output format rules are clear in the example

    it would be nice to have clear input format rules ( including charset/encoding ), common for everybody

  16. […] Nick Halstead , blogunda bir PHP yarışmasından bahsetmiÅŸ.Kazanan Zend Studio ile ödüllendirilecekmiÅŸ.Yapılması istenen ise , belli kelimelerdeki harflerin yerleri deÄŸiÅŸtirilerek yeni ve anlamlı kelimeler türeten PHP kodunu yazmak.Ayrıntılar burada. […]

  17. The way you described this, it sounds like the presentation doesn’t need to be anything special. Is this true?

    Jason

  18. Paul, I would rather not have to worry about .htaccess overrides of PHP settings so the answer is no you cannot use php_value.

    Jason, The implementation is the most important aspect of the competition. Presentation of the code (i.e. use of coding standards) is important. We are not concerned about stylish looking pages.

  19. Somehow I assumed that words should come from an uploaded file.
    But you mentioned using AJAX within data entry.
    My app is almost complete, should I bother adding form for entering single words?
    Or do you don’t care what the source is?

    Also is it correct that you can only transform words of the same length?

  20. Antych, by definition switching existings letters does mean that the words must be of equal length, so yes.

  21. What about my main question, can words be uploaded from a file?
    Or does it need a form to enter words one by one?
    Do you care how data is entered?

  22. Nick,

    I will be resubmitting in that case later today. Please disregard my first entry once you get my second one.

    Jason

  23. antych, a file upload meets the specified requirements. I have edited my previous comment about AJAX as it was misleading.

  24. […] am running a PHP Programming Contest and you can win a copy of Zend Studio Professional. If you’re new here, you may want to subscribe […]

  25. There are variations of this game about.

    Which rules can/should we be applying?

    Fixed-position letters: (HAND to FOOT)
    e.g (as example above) HAND, BAND, BOND, FOND, FOOD, FOOT

    Mixed-position letters (MILK to PAIL)
    e.g MILK, MILL, MAIL, PAIL

    Mixed-length (add and remove, as well as change) (and variation of above) (EAT to FOOD)
    EAT, HATE, HEART, THREAD, DEATH, HEAT, HEAR, FEAR, REEF, REED, HEED, HOED, HOOD, FOOD

  26. The rules state that you can only change one letter at a time. It does not say you can move letters around and it does not state that you can add/remove letters.

    I do not know what you mean by ‘mixed-position letters’ your example of

    MILK, MILL, MAIL, PAIL

    MILL -> MAIL Requires that ‘I’ moves and for ‘A’ to change to ‘L’ or for ‘I’ + ‘L’ to change to ‘A’ + ‘I’ neither which fit the stated rules.

    The correct example is.

    MILK, mill, pill, pall, PAIL

  27. hey!

    Just to ensure that I got it right (I’m non-english, never heared of this show :)). The user may enter any valid word in any language. The starting and the resulting word must be of same length.

    When importing the file with the words. Does the file have to be in any specific format? Do we need to provide any end-user documentation? Which encoding do the PHP files need to be?

    Thanks!

  28. […] ciekawy konkurs algorytmiczny - polecam wszystkim, którzy lubiÄ… wyzwania. Tutaj jest link do konkursu, jak tylko znajdÄ™ kila godzin czasu, to pomyÅ›lÄ™ i ja nad rozwiÄ…zaniem PomysÅ‚ mi siÄ™ podoba - […]

  29. markus, the file you import can be any format you desire. The PHP files should be UTF8 for ease of my setup. You do not *have* to supply end user documentation unless you feel your application requires it.

  30. Just one more question :)
    I’m using ZF with mod_rewrite and I run it from vhost. I didn’t bother making links relative so it will only work from document root or a vhost. Are you ok with that? Or does it have to be changed.
    Btw. Additionally to sending you the zip file I can put the app on my own hosting, so you can save yourself some time setting it up and I can make sure you see it work, in an unlikely event that smth goes wrong. How about it? :)

  31. mod_rewrite is fine. document root is fine. Please include the ZF within project. You can host it yourself but I do still need to have it work on my test system.

  32. requirements state:
    “The user must be able to specify the source for valid words”

    Would this be satisfied by offering the user to select from a choice of (built in) dictionaries (services)

    or

    is it required that they can pick *ANY* source of words (ie, upload arbitrary word lists)

    Thanks - sounds like fun.

  33. Hi all !

    I have 2 questions.

    1. What symbols are allowed to create words ?
    2. Can I assume that the word list is not huge (so, can I put it into array without memory problems) ?

  34. Is it ok for you guys to create a dictionary so we can test the input?
    in my dictionary, some word does not exist, for example, shyer

  35. […] Halstead is running a PHP contest on his blog and offering a free copy of Zend Studio to the winner. It’s a wonderfully simple […]

  36. […] am running a PHP Programming Contest and you can win a copy of Zend Studio Professional. If you’re new here, you may want to subscribe […]

  37. PHP Programming Contest…

    I just committed my code for the The PHP-Programming-Contest. But I’m not really happy about it. First of all I thought I will do it in an hour, and really after an hour the first version worked. But ……

  38. My country is at summer time and I got confused.
    I think I have sent the solution 1 hour later. Will it be accepted?

  39. I have been a little late closing the competition, but as long as you submit it within the next hour I will accept it.

  40. Just checking what time it is!

  41. […] So I found this programming contest on the internet and thought it would be kind of cool to see if I could come up with something to solve the problem posed and if I did get something cool done in time then I’d submit it. The contest can be found at http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio. […]

  42. Where can I see the winning solution?
    John

  43. Winning post here:

    http://blog.assembleron.com/2007/07/21/php-competition-results-the-winner/

    Second Place:
    http://blog.assembleron.com/2007/07/20/php-competition-results-second-place/

    Third Place:
    http://blog.assembleron.com/2007/07/19/php-competition-results-third-place/

  44. Younggayboys…

    Younggayboys…

  45. is there any other such contest comming in some time in mid of 2008. I would like to get full details for that

  46. Looking for another PHP contest this year!

Post a Response