in reply to Re (tilly) 3: (Golf) Let's go bowling
in thread (Golf) Let's go bowling
Short though this is it fails the test suite
print score(qw(5 / 6 3 X X 7 0 4 3 X 4 / 8 1 3 / 6)),"--> 146\n"; print score(qw(X X X X X X X X X X X X)), "--> 300\n"; print score(qw(0 / X 0 / X 0 / X 0 / X 0 / X 0 /)),"--> 200\n"; print score(qw(X 0 / X 0 / X 0 / X 0 / X 0 / X 0)),"--> 200\n"; sub score { $i=$s=0;$s-=$_[-1]if"@_[-2,-1]"=~m!/|X!;map{$s+=$_[$i-1],$_=/X/?($s+=$ +_[$i-2],10):10-$_[$i+1]if/\D/;$s+=$_;$i++}@_=(0,0,reverse@_);$s } __END__ 146--> 146 330--> 300 210--> 200 210--> 200
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 5: (Golf) Let's go bowling
by tilly (Archbishop) on Aug 09, 2001 at 02:53 UTC |
In Section
Meditations