in reply to Golfing Colors


This isn't really a problem of combinations, it's a printf problem. ;-)

The direct approach works just as well:
my $h = 0x33; for my $i (0..5) { for my $j (0..5) { for my $k (0..5) { printf"#%02x%02x%02x\n", $i*$h, $j*$h, $k*$h; } } }
And the best I can golf that to is 77 chars: for $a(0..5){for $b(0..5){printf"#%02x%02x%02x\n",$a*51,$b*51,$_*51for 0..5}} As an aside, the common abuse of $a and $b in Golf isn't really in the spirit of strict even if it does give strict compliance.

John.
--

Replies are listed 'Best First'.
Re: Re: Golfing Colors
by iamcal (Friar) on Jun 01, 2001 at 20:54 UTC
    75 if you drop those two spaces: for$a(0..5){for$b(0..5){printf"#%02x%02x%02x\n",$a*51,$b*51,$_*51for 0..5}}
Re: Re: Golfing Colors
by petral (Curate) on Jun 03, 2001 at 18:42 UTC
      "As an aside, the common abuse of $a and $b in Golf isn't really in the spirit of strict even if it does
        give strict compliance."


    That's golf, brother. (Just picture a cloister full of monks quietly going about their business and all pausing to stick their tongues out at you.)

      p