Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add colors (still needs some straightening out, another patch to come…

… soon).
  • Loading branch information...
commit ac5d650b4f254738f05f6ccbbe75deb357a9e4d1 1 parent 3067d00
colomon authored

Showing 1 changed file with 222 additions and 1 deletion. Show diff stats Hide diff stats

  1. +222 1 mandelbrot-color.pl
223 mandelbrot-color.pl
@@ -7,6 +7,227 @@
7 7 my $upper-right = -2 + (5/4)i;
8 8 my $lower-left = 1/2 - (5/4)i;
9 9
  10 +my @color_map = (
  11 + "0 0 0",
  12 + "0 0 252",
  13 + "64 0 252",
  14 + "124 0 252",
  15 + "188 0 252",
  16 + "252 0 252",
  17 + "252 0 188",
  18 + "252 0 124",
  19 + "252 0 64",
  20 + "252 0 0",
  21 + "252 64 0",
  22 + "252 124 0",
  23 + "252 188 0",
  24 + "252 252 0",
  25 + "188 252 0",
  26 + "124 252 0",
  27 + "64 252 0",
  28 + "0 252 0",
  29 + "0 252 64",
  30 + "0 252 124",
  31 + "0 252 188",
  32 + "0 252 252",
  33 + "0 188 252",
  34 + "0 124 252",
  35 + "0 64 252",
  36 + "124 124 252",
  37 + "156 124 252",
  38 + "188 124 252",
  39 + "220 124 252",
  40 + "252 124 252",
  41 + "252 124 220",
  42 + "252 124 188",
  43 + "252 124 156",
  44 + "252 124 124",
  45 + "252 156 124",
  46 + "252 188 124",
  47 + "252 220 124",
  48 + "252 252 124",
  49 + "220 252 124",
  50 + "188 252 124",
  51 + "156 252 124",
  52 + "124 252 124",
  53 + "124 252 156",
  54 + "124 252 188",
  55 + "124 252 220",
  56 + "124 252 252",
  57 + "124 220 252",
  58 + "124 188 252",
  59 + "124 156 252",
  60 + "180 180 252",
  61 + "196 180 252",
  62 + "216 180 252",
  63 + "232 180 252",
  64 + "252 180 252",
  65 + "252 180 232",
  66 + "252 180 216",
  67 + "252 180 196",
  68 + "252 180 180",
  69 + "252 196 180",
  70 + "252 216 180",
  71 + "252 232 180",
  72 + "252 252 180",
  73 + "232 252 180",
  74 + "216 252 180",
  75 + "196 252 180",
  76 + "180 252 180",
  77 + "180 252 196",
  78 + "180 252 216",
  79 + "180 252 232",
  80 + "180 252 252",
  81 + "180 232 252",
  82 + "180 216 252",
  83 + "180 196 252",
  84 + "0 0 112",
  85 + "28 0 112",
  86 + "56 0 112",
  87 + "84 0 112",
  88 + "112 0 112",
  89 + "112 0 84",
  90 + "112 0 56",
  91 + "112 0 28",
  92 + "112 0 0",
  93 + "112 28 0",
  94 + "112 56 0",
  95 + "112 84 0",
  96 + "112 112 0",
  97 + "84 112 0",
  98 + "56 112 0",
  99 + "28 112 0",
  100 + "0 112 0",
  101 + "0 112 28",
  102 + "0 112 56",
  103 + "0 112 84",
  104 + "0 112 112",
  105 + "0 84 112",
  106 + "0 56 112",
  107 + "0 28 112",
  108 + "56 56 112",
  109 + "68 56 112",
  110 + "84 56 112",
  111 + "96 56 112",
  112 + "112 56 112",
  113 + "112 56 96",
  114 + "112 56 84",
  115 + "112 56 68",
  116 + "112 56 56",
  117 + "112 68 56",
  118 + "112 84 56",
  119 + "112 96 56",
  120 + "112 112 56",
  121 + "96 112 56",
  122 + "84 112 56",
  123 + "68 112 56",
  124 + "56 112 56",
  125 + "56 112 68",
  126 + "56 112 84",
  127 + "56 112 96",
  128 + "56 112 112",
  129 + "56 96 112",
  130 + "56 84 112",
  131 + "56 68 112",
  132 + "80 80 112",
  133 + "88 80 112",
  134 + "96 80 112",
  135 + "104 80 112",
  136 + "112 80 112",
  137 + "112 80 104",
  138 + "112 80 96",
  139 + "112 80 88",
  140 + "112 80 80",
  141 + "112 88 80",
  142 + "112 96 80",
  143 + "112 104 80",
  144 + "112 112 80",
  145 + "104 112 80",
  146 + "96 112 80",
  147 + "88 112 80",
  148 + "80 112 80",
  149 + "80 112 88",
  150 + "80 112 96",
  151 + "80 112 104",
  152 + "80 112 112",
  153 + "80 104 112",
  154 + "80 96 112",
  155 + "80 88 112",
  156 + "0 0 64",
  157 + "16 0 64",
  158 + "32 0 64",
  159 + "48 0 64",
  160 + "64 0 64",
  161 + "64 0 48",
  162 + "64 0 32",
  163 + "64 0 16",
  164 + "64 0 0",
  165 + "64 16 0",
  166 + "64 32 0",
  167 + "64 48 0",
  168 + "64 64 0",
  169 + "48 64 0",
  170 + "32 64 0",
  171 + "16 64 0",
  172 + "0 64 0",
  173 + "0 64 16",
  174 + "0 64 32",
  175 + "0 64 48",
  176 + "0 64 64",
  177 + "0 48 64",
  178 + "0 32 64",
  179 + "0 16 64",
  180 + "32 32 64",
  181 + "40 32 64",
  182 + "48 32 64",
  183 + "56 32 64",
  184 + "64 32 64",
  185 + "64 32 56",
  186 + "64 32 48",
  187 + "64 32 40",
  188 + "64 32 32",
  189 + "64 40 32",
  190 + "64 48 32",
  191 + "64 56 32",
  192 + "64 64 32",
  193 + "56 64 32",
  194 + "48 64 32",
  195 + "40 64 32",
  196 + "32 64 32",
  197 + "32 64 40",
  198 + "32 64 48",
  199 + "32 64 56",
  200 + "32 64 64",
  201 + "32 56 64",
  202 + "32 48 64",
  203 + "32 40 64",
  204 + "44 44 64",
  205 + "48 44 64",
  206 + "52 44 64",
  207 + "60 44 64",
  208 + "64 44 64",
  209 + "64 44 60",
  210 + "64 44 52",
  211 + "64 44 48",
  212 + "64 44 44",
  213 + "64 48 44",
  214 + "64 52 44",
  215 + "64 60 44",
  216 + "64 64 44",
  217 + "60 64 44",
  218 + "52 64 44",
  219 + "48 64 44",
  220 + "44 64 44",
  221 + "44 64 48",
  222 + "44 64 52",
  223 + "44 64 60",
  224 + "44 64 64",
  225 + "44 60 64",
  226 + "44 52 64",
  227 + "44 48 64",
  228 +);
  229 +
  230 +
10 231 sub mandel(Complex $c) {
11 232 my $z = 0i;
12 233 for ^$max_iterations {
@@ -27,5 +248,5 @@ ($low, $high, $count)
27 248 for subdivide($upper-right.re, $lower-left.re, $height) -> $re {
28 249 my @line = subdivide($re + ($upper-right.im)i, $re + 0i, ($width + 1) / 2).map({ mandel($_) });
29 250 my $middle = @line.pop;
30   - (@line, $middle, @line.reverse).map({ $_ xx 3 }).join(' ').say;
  251 + (@line, $middle, @line.reverse).map({ @color_map[$_] }).join(' ').say;
31 252 }

0 comments on commit ac5d650

Please sign in to comment.
Something went wrong with that request. Please try again.