A long while back Code Golf posted up the Saving Time challenge in which you were required to transform input representing a digital clock into an ASCII analog representation in as few key strokes as possible. Here were my solutions in both PHP and Python:

PHP: 234 characters






Not exactly the most beautiful code. If there’s a shorter way of converting from decimal to hex I’d probably cut 10 more characters or so.

Python: 232 characters

h,m=[int(x) for x in raw_input().split(':')];s=dict(zip('0b1a29384756','o'*12))
s[h]='h';s[m]='mx'[h==m];print "%9s\n%5s%8s\n\n %s%14s\n\n%s%16s\n\n %s%14s\n\n%5s%8s\n%9s"%tuple(s.values())

The Python code is in no way exemplary as it’s mostly a translation of the PHP code. What I can’t fathom is how someone could possibly solve this problem in 134 characters in PHP, the way eyepopslikeamosquito did. That is insane my friend. Probably ran a Perl solution through PHP’s shell command functions.