If anyone were interested, here's my ridiculous 145

#!perl -nl
$n++||y/x/0/;$t.=$_}{map{$y=$x=!map{$a[10*++$x-$y]=$_.$/x!$y;$x=!++$y
if$x=~0}$t=~/./g;($t=join"",@a)=~s/0x|x0/00/g}0..97;print$t=~/^.*0/?1:0

This substitutes xs on the first line for 0s, then (the ridiculous part)
it takes a 10x10 grid, and substitutes out xs adjacent to 0s, then
rotates the grid 90 degrees, does that 98 times, then checks for the
presence of a 0 on the top line.

I really need to think more about my methods before I start coding.
Having to split to an array before rotating, and then rejoining to a
scalar before the substitution was a bit of a killer.

My 303 odd was:

#!perl -nl
@{$p[++$k]}=/./g}{
%r=(d,['01drlu'=~/./g],r,['10drul'=~/./g],l,[-1,0,dlur=~/./g],u,[0,-1,rlud=~/./g]);
for$x(0..9){$y=$c=0 if 10>$y;1 while 10>$y&&&g&&$c<99}print$y>9|0;
sub g{for(@{$r{$l||d}}[2..5]){$c++;($s,$t)=@{$r{$_}};$x+=$s;$y+=$t;
$x+1&&$y+1&&${$p[$y]}[$x]=~x?return$l=$_:($x-=$s)&($y-=$t)}0}

which has a hash of little walkabout rules to walk through the paths, and
which gives up on a path if it hasn't gotten there in 99 moves.

I like the 55 better, however, I think.

Jasper
-- 
Anyone who says they haven't is either a liar or a fool.

Reply via email to