What Happened to phpGolf

As the creator and maintainer of phpGolf(.org), people ask me what happened to the php code golfing site. The reason was basically that the server owner wanted to change to another hosting vendor. Since I was out of the country for a year, without proper access to my developing infrastructure, and limited amount of spare time, it just never got back online. If the site was to get back now, it would require another dedicated person to rewrite the old code, polish the design, dockerize it, and basically carry the whole thing. The source can be found on GitHub, except for the challenges, but I can provide those for anyone interested.

_config.yml

I will now show off one of the most impressive work from the public challenges. It was submitted in 2012 by the talented user primo, whom had the top score on all challenges.

The challenge description were as follows:

  • The constant MAP will contain one map.
  • Your program should output, to standard out, one single number, 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
  • The map will always be closed, i.e. they will have a wall that reaches all the way around.
  • The map are of random size, but no map will be greater than 50*50.
  • The map may not always be square, but will always be rectangular.
  • You may only move up, down, left or right. No diagonals.

Example input value (Given in the MAP constant on runtime):

####################################
####################################
####### ############################
######  .###########################
######   ##############X ###########
#####     ##############  ##########
##### #  ############  ## ##########
#####       #######    #   #########
#######     ##### #      ###########
########  #####           ##########
########   #### ####   #############
########  #  #  ####   #############
########         ###################
#########        ###################
####################################

Example answer: 36

This was the leading submission with only 118 bytes filesize!

<?for(;—^$f=$m[strpos($m=~MAP,Ñ)+$c=~(%2*strpos($m,õ))*~-(&2)+$p=$a[++/5-3]];)${$$f|$$c?z:$a[]=$c}=$$p+1;echo$z;

The unrecognized char on pos 7 is \u97. I will follow up with a post about tips and tricks for golfing in php later on, which will explain some of the weird things going on here.

Written on April 16, 2018