#!/usr/local/bin/perl
#$Cols=79; $Lines=30;
$Cols=64; $Lines=64;
$MaxIter=63;
$MinRe=-2.0; $MaxRe=2.0;
$MinIm=-2.0; $MaxIm=2.0;
@chars=(' ','.',',','-',':','/','=','H','O','A','M','%','&','$','#','@','_');
$cr=0.0; $ci=.80;
 
for($Im=$MaxIm;$Im>=$MinIm;$Im-=($MaxIm-$MinIm)/$Lines)
{ for($Re=$MinRe;$Re<=$MaxRe;$Re+=($MaxRe-$MinRe)/$Cols)
  { $zr=$Re; $zi=$Im;
    for($n=0;$n<$MaxIter;$n++)
    { $a=$zr*$zr; $b=$zi*$zi;
      if($a+$b>4.0) { last; }
      $zi=2*$zr*$zi+$ci; $zr=$a-$b+$cr;
    }
    print $chars[$n/4];
  }
  print "\n";
}
