home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / games / new / 920104.0 < prev    next >
Encoding:
Internet Message Format  |  1992-01-03  |  1.7 KB

  1. Path: uunet!think.com!samsung!munnari.oz.au!news.hawaii.edu!jach.hawaii.edu!JOEL
  2. From: joel@jach.hawaii.edu
  3. Newsgroups: vmsnet.sources.games
  4. Subject: MANDELBROT source
  5. Message-ID: <1992Jan4.061137.14200@news.Hawaii.Edu>
  6. Date: 4 Jan 92 06:11:37 GMT
  7. Sender: root@news.Hawaii.Edu (News Service)
  8. Reply-To: joel@jach.hawaii.edu
  9. Organization: UK/Canada/Netherlands Joint Astronomy Centre, Hilo, HI
  10. Lines: 73
  11. Nntp-Posting-Host: maikai.jach.hawaii.edu
  12.  
  13. c    MANDELBROT in VAX/VMS Fortran/PGPLOT, output to Tek 4014
  14. c
  15. c    Dec '91        Joel Aycock (JOEL@JACH.HAWAII.EDU)
  16. c            UK Infrared Telescope
  17. c            Joint Astronomy Centre, Hawaii
  18.  
  19. c        must be linked with PGPLOT library: GRPSHR.OLB
  20.  
  21.     integer    iter
  22.     real    r,i,rstart,rend,istart,iend,size,step
  23.     real    pistart,piend
  24.     real*16    r16,i16,zr,zi,newzr,newzi
  25.  
  26.     write (5,10)
  27. 10    format (//'$   start (real,imaginary) ')
  28.     read (5,*) rstart,istart
  29.  
  30.     write (5,15)
  31. 15    format (//'$        extent, step size ')
  32.     read (5,*) size,step
  33.  
  34.     rend = rstart + size
  35.     iend = istart + size
  36.  
  37.     pistart = istart
  38.     piend   = iend
  39.  
  40.     write (5,20)
  41. 20    format (//'$               iterations ')
  42.     read (5,*) iter
  43.  
  44.     if ((istart.lt.0.).and.(iend.gt.0.)) then
  45.         if (abs(istart).gt.iend) then
  46.             iend=0.
  47.           else
  48.             istart=0.
  49.         endif
  50.     endif
  51.  
  52.     type *,char(27),'[?38h'
  53.  
  54.     call pgbegin(0,'TEK',1,1)
  55.     call pgenv(rstart,rend,pistart,piend,0,1)
  56.  
  57.     do r=rstart,rend,step
  58.         do i=istart,iend,step
  59.           r16=r
  60.           i16=i
  61.           zr=0.
  62.           zi=0.
  63.           do n=1,iter
  64.             newzr = zr*zr-zi*zi+r16
  65.             newzi = 2.*zr*zi+i16
  66.             if ((newzr.eq.zr).and.(newzi.eq.zi)) goto 100
  67.             zr = newzr
  68.             zi = newzi
  69.             if ((zr*zr+zi*zi).gt.4.) goto 200
  70.           enddo
  71.  
  72. 100          call pgpoint(1,r,i,-1)
  73.           call pgpoint(1,r,-i,-1)
  74.  
  75. 200        enddo
  76.     enddo
  77.  
  78.     call pgend
  79.  
  80.     read (5,900) test
  81.     type *,char(27),'[?38l'
  82. 900    format (a1)
  83.  
  84.     stop
  85.     end
  86.