Teh #kodehjelp Labyrinthic Games of 2008 Language: PHP (5.2.6) Rules: 1. The winner is decided by whoever has the smallest size of the source code file. 1.1 If two -- or more -- persons happen to have the same source size, the fastest solution wins. This is decided by running both solutions a large number of times. If the solutions are within 10% of each other in running time, the solution delivered first wins. 2. The code will be run with error_reporting(E_ALL); and can not generate any warnings, notices or any other message from the PHP interpreter itself. You can assume that the environment is correctly set up when your code is invoked, so you do not need to call error_reporting yourself. 3. You may not assume that any custom extension is available, even if it's in PECL. The standard installation of PEAR is available, but if you're aiming to win, it's probably not the way to go. 4. Contributions not in the "general spirit" of the competition will be disqualified, even if they adher to the rules posted here. 5. The PHP interpreter will be run with: short_tags = Off magic_quotes_gpc = Off memory_limit = 32M 7. The input will be provided in a file named maps.txt which will be placed in the same directory as where your code is run. You can not change this filename. We will not edit submitted code where the filename is wrong. 8. The file may contain several labyrinths, each separated by an empty line. 9. Your program should output, to standard out (using echo or print) one single number on each line: the shortest distance from . to X. (alas, how many moves are the absolute minimum to get from the spot marked with '.' to the spot marked with 'X'. (do not include the starting position, but include the end position) 10. All labyrinths will be closed, i.e. they will have a wall that reaches all the way around. 11. No labyrinth will be greater than 100*100 in size. 12. Labyrinths may not always be square, but will always be rectangular. 13. You may only move up, down, left or right. No diagonals. 14. The file will be terminated by an empty line. 15. The filename of your file will be obfuscated before being run. 16. Your script will not have internet access when being run. Code must be delivered before 23:59:59 on Sunday 10. of August 2008. Delivery to mats < at > lindh < dot > no Example of playing field: #################### #X # # # #### # ########### # # # # # # # #### # ##### ##### # # # #### ########## # # # # # #### # # ########### # # # # # #### ########### # # # ########### # #### ### # # # ## ###### # # # ### # # # # # ### #### #### # # # # #### # # # ## # ##### #### # # .# #################### .. should output (unless I've counted wrong): 42