sub golf { # 1 2 3 4 5 #2345678901234567890123456789012345678901234567890 ($h,$f)=@_;$w=$"x($h-1);$_="$w=$w\n";@a=qw/0 @ + * /;push @a,'=' for(1..4/$f);$p.=$_ while s/ (=+) /= $1=/;$p=~s#=#$a[rand 4/$f]#eg;print"$w*$w\n$p" } $golf(10,0.3); * =@= =+==@ @=@=0=+ ==+===@=* ==========0 0===0*=@*=@+= =+======@@====+ =====+=@====0==== ===@======+*+*=+==*