Permalink
Browse files

Move scripts to bin and (hopefully) make them executable.

  • Loading branch information...
1 parent 93318a2 commit 902d9dbcc119a7141dc502610764481d5671a850 @colomon committed Sep 13, 2010
Showing with 7 additions and 5 deletions.
  1. +7 −5 { → bin}/mandelbrot-color.pl
  2. 0 { → bin}/mandelbrot.pl
View
@@ -5,8 +5,8 @@
my $width = $height;
my $max_iterations = 50;
-my $upper-right = -2 + (5/4)i;
-my $lower-left = 1/2 - (5/4)i;
+my $upper-right = -2.Num + (5/4.Num)i;
+my $lower-left = 1/2.Num - (5/4.Num)i;
my @color_map = (
"0 0 0",
@@ -231,17 +231,18 @@
sub mandel(Complex $c) {
my $z = 0i;
- for ^$max_iterations {
+ my $i;
+ loop ($i = 0; $i < $max_iterations; $i++) {
if ($z.abs > 2) {
- return $_ + 1;
+ return $i + 1;
}
$z = $z * $z + $c;
}
return 0;
}
sub subdivide($low, $high, $count) {
- (^$count).map({ $low + ($_ / ($count - 1)) * ($high - $low) });
+ (^$count).map({ $low + ($_.Num / ($count - 1)) * ($high - $low) });
}
say "P3";
@@ -253,3 +254,4 @@ ($low, $high, $count)
my $middle = @line.pop;
(@line, $middle, @line.reverse).map({ @color_map[$_] }).join(' ').say;
}
+
View
File renamed without changes.

0 comments on commit 902d9db

Please sign in to comment.