in reply to Symmetrical Date Golf

Two solutions.
# This is 165 characters for(grep{/(..)(..)/;$1<24&&$2<60}map{sprintf"%04d",$_}0..2359){($t=$_) +=~s/(..)(..)/$1:$2/;$y=reverse;print map{"$t\t$_\t$y\n"}qw(10/01 20/0 +2 30/03 01/10 11/11 21/12)} ---- # This is 164 characters map{($t=$_)=~s/(..)(..)/$1:$2/;$y=reverse;print map{"$t\t$_\t$y\n"}qw( +10/01 20/02 30/03 01/10 11/11 21/12)}grep{/(..)(..)/;$1<24&&$2<60}map +{sprintf"%04d",$_}0..2359
Update: Changed || to && as per metadoktor's note. This fixes the bug found.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Re: Symmetrical Date Golf
by metadoktor (Hermit) on Feb 28, 2002 at 16:38 UTC
    I think your solutions are incomplete. They generate dates like this:
    00:90 20/02 0900
    which aren't valid since there aren't 90 minutes in an hour. ryan claims that there are 8640 solutions. I got a different number though...

    metadoktor

    "The doktor is in."