in reply to Re: (Golf) Decorating the Christmas Tree
in thread (Golf) Decorating the Christmas Tree

I can tie Rhose's 86 by a tiny adjustment to yours:
$j=1;print$"x--$h,$_-1?map(rand>$f?"=":qw( 0 @ * +)[rand 4],1..($j+=2)):"*",$/for 1..$h
I moved a set of parens. And I can trim it even more:
print$"x--$h,$_-1?map(rand> $f?"=":qw(0 @ * +)[rand 4], 1..($j+=2)):"*",$/for++$j..$h
I moved $j's assignment to the "fore" loop. 83 characters. And then another adjustment that gets rid of $j entirely, and puts me at (an updated) 77 -- the parens around map's arguments were unneeded.
print$"x--$h,$_-1?map rand> $f?"=":qw(0 @ * +)[rand 4], 2..$_*2:"*",$/for 1..$h

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Re: (Golf) Decorating the Christmas Tree
by dragonchild (Archbishop) on Dec 04, 2001 at 01:49 UTC
    Independently arriving at this (after playing some more), I get:
    print$"x$h--,$_-1?map{rand>$f?'=':qw(* 0 @ +)[rand 4]}2..2*$_:'*',$/fo +r 1..$h
    For some reason, I count that at 77?? Why am I one shorter?

    ------
    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.

      You are not putting parens around the map arguments, saving one character. You have block delimiters around the first map argument instead of parens around both arguments, so you don't need the comma to separate the two arguments. Congratulations :)

      Update: Though it seems the parens were completely unnecessary (though a space between map and the first arg is necessary in japhy's answer, so now your answer's are tied, i.e. length('map func,@arr')==length('map{func}@array')).