use Image::Magick; $x = 1; $y = 1; print "Welcome to the King's Dream.\n 1. To Draw the King's Dream.\n 2. To draw another cool picture.\n 3. To draw another diffrent cool picture.\n 4. To enter your own points to draw.\n Choice: "; chomp($choice = <>); if($choice==4){ print "A: ";chomp($a = <>); print "B: ";chomp($b = <>); print "C: ";chomp($c = <>); print "D: ";chomp($d = <>); }elsif($choice==2){ $a=-.942868; $b=-1.934392; $c=1.084818; $d=1.015843; }elsif($choice==3){ $a=-.9986501; $b=-2.325941; $c=1.016406; $d=.7704654; }else{ $a=-.966918; $b=2.979879; $c=.765145; $d=.744728; } print "Enter the X resolution(enter for 1000): "; chomp($xres = <>); if(!$xres){$xres = 1000;} print "Enter the Y resolution(enter for 1000): "; chomp($yres = <>); if(!$yres){$yres = 1000;} print "Enter the number of iterations(enter for 40000): "; chomp($iterations = <>); if(!$iterations){$iterations = 40000;} print "Enter file name(enter for kingsdream.jpg): "; chomp($filename = <>); if(!$filename){$filename = "kingsdream.jpg";} $image = Image::Magick->new; $image->Set(size=>"$xres"."x"."$yres"); $image->ReadImage('xc:black'); for($i = 1;$i<$iterations;$i++){ $xn = sin($y*$a) + $c*sin($x*$a); $yn = sin($x*$b) + $d*sin($y*$b); $x = $xn; $y = $yn; $xp = int($x*$xres/4 + $xres/2); $yp = int($y*$yres/4 + $yres/2); $image->Set("pixel[$xp,$yp]"=>"white"); } $image->Write("$filename"); print "Done.";

In reply to Kings Dream by snowsmann

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.