Data update
This commit is contained in:
parent
796d366b97
commit
35bcdeebf8
504 changed files with 7045 additions and 610 deletions
16
Task/Mandelbrot-set/Inform-7/mandelbrot-set-2.inf
Normal file
16
Task/Mandelbrot-set/Inform-7/mandelbrot-set-2.inf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(function mandelbrot width height depth
|
||||
(.. str
|
||||
(for yy (range height)
|
||||
xx (range width)
|
||||
(let c_re (/ (* (- xx (/ width 2)) 4) width)
|
||||
c_im (/ (* (- yy (/ height 2)) 4) width)
|
||||
x 0 y 0 i 0)
|
||||
(while (and (<= (+ (** x) (** y)) 4)
|
||||
(< i depth))
|
||||
(let x2 (+ c_re (- (** x) (** y)))
|
||||
y (+ c_im (* 2 x y))
|
||||
x x2
|
||||
i (inc i)))
|
||||
(strn ((zero? xx) "\n") (i "ABCDEFGHIJ ")))))
|
||||
|
||||
(mandelbrot 48 24 10)
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
constant MAX-ITERATIONS = 1000;
|
||||
constant MAX-ITERATIONS = 64;
|
||||
my $width = +(@*ARGS[0] // 800);
|
||||
my $height = $width + $width %% 2;
|
||||
say "P1";
|
||||
say "P2";
|
||||
say "$width $height";
|
||||
say MAX-ITERATIONS;
|
||||
|
||||
sub cut(Range $r, UInt $n where $n > 1 --> Seq) {
|
||||
$r.min, * + ($r.max - $r.min) / ($n - 1) ... $r.max
|
||||
|
|
@ -14,9 +15,9 @@ my @im = cut( 0 .. 5/4, 1 + ($height div 2)) X* 1i;
|
|||
sub mandelbrot(Complex $z is copy, Complex $c --> Int) {
|
||||
for 1 .. MAX-ITERATIONS {
|
||||
$z = $z*$z + $c;
|
||||
return 0 if $z.abs > 2;
|
||||
return $_ if $z.abs > 2;
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
my @lines = hyper for @im X+ @re {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue