home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / biomrf.zip / BIOPLOT.INC < prev    next >
Text File  |  1988-05-12  |  3KB  |  104 lines

  1. ' Subroutine BIOPLOT
  2. ' This routine plots the biomorphs according to the parameters held in the
  3. ' "gene" array, biomorphs%().
  4. ' Each one is plotted in turn as a series of vectors, each vector being held
  5. ' in the local array POSNS%(). The data is stored as:
  6. ' n,0 = x-coordinate of start position
  7. ' n,1 = y-coordinate ------- " -------
  8. ' n,2 = length of vector
  9. ' n,3 = angle of vector from 0 = vertically upwards, in degrees
  10. '
  11. ' The array is 2048 elements long to allow 10 iterations, and takes up 16K
  12. ' Plotting occurs as follows:
  13. ' One iteration is completed from a base "address" of 2^(itn%)-1 until it is
  14. ' finished. The next one starts immediately, reading the vector from which
  15. ' it comes as the old base address is stored.
  16.  
  17. SUB BIOPLOT(posns%(2),biomorphs%(2),popn%)
  18.  
  19. local presntbase%,oldbase%,itn%,bio%
  20.  
  21. for bio% = 1 to popn%
  22.     
  23.     if bio% < 9 then
  24.                 if bio%/2 = int(bio%/2) then
  25.                     y% = 70
  26.                 else
  27.             y% = 85
  28.         end if    
  29.         x% = 50+((bio%-1)*80)
  30.     else
  31.         if bio%/2 = int(bio%/2) then
  32.             y% = 150
  33.         else
  34.                 y% = 165
  35.         end if
  36.         x% = 50+((bio%-9)*80)
  37.     end if
  38.     
  39.     reflec% = x%
  40.     
  41.     line (x%,y%)-(x%,(y%-biomorphs%(bio%,8)))
  42.     
  43.     posns%(1,1) = x% : posns%(1,2) = y%
  44.     posns%(1,3) = biomorphs%(bio%,8) : posns%(1,4) = 90
  45.     
  46.     posns%(2,2) = (y%-biomorphs%(bio%,8)) : posns%(2,1) = x%
  47.  
  48.     if biomorphs%(bio%,5)/2 = int(biomorphs%(bio%,5)/2) then
  49.             posns%(2,3) = biomorphs%(bio%,3) + biomorphs%(bio%,4)
  50.         else
  51.             posns%(2,3) = biomorphs%(bio%,3) * biomorphs%(bio%,4)
  52.         end if
  53.     
  54.     posns%(2,4) = biomorphs%(bio%,6)
  55.     presntbase% = 2
  56.     
  57.     call vectorplot(posns%(),reflec%,presntbase%)
  58.     
  59.     oldbase% = 2
  60.     
  61.     for itn% = 1 to biomorphs%(bio%,2)
  62.         presntbase% = 2^itn% + 1
  63.         count% = presntbase%
  64.     
  65.         for vector% = oldbase% to (presntbase%-1)
  66.             xroot% = posns%(vector%,1) - posns%(vector%,3)*sin(posns%(vector%,4)/6.28319)
  67.             yroot% = posns%(vector%,2) + posns%(vector%,3)*cos(posns%(vector%,4)/6.28319)
  68.             posns%(count%,1) = xroot%
  69.             posns%(count%,2) = yroot%
  70.  
  71.             if biomorphs%(bio%,5)/2 = int(biomorphs%(bio%,5)/2) then
  72.                 posns%(count%,3) = biomorphs%(bio%,3) + biomorphs%(bio%,4)
  73.             else
  74.                 posns%(count%,3) = biomorphs%(bio%,3) * biomorphs%(bio%,4)
  75.             end if
  76.  
  77.             posns%(count%,4) = biomorphs%(bio%,6)    
  78.     
  79.             call vectorplot(posns%(),reflec%,count%)
  80.     
  81.             count% = count% + 1
  82.             posns%(count%,1) = xroot%
  83.             posns%(count%,2) = yroot%
  84.  
  85.             if biomorphs%(bio%,5)/2 = int(biomorphs%(bio%,5)/2) then
  86.                 posns%(count%,3) = biomorphs%(bio%,3) + biomorphs%(bio%,4)
  87.             else
  88.                 posns%(count%,3) = biomorphs%(bio%,3) * biomorphs%(bio%,4)
  89.             end if
  90.  
  91.             posns%(count%,4) = biomorphs%(bio%,7) - biomorphs%(bio%,6)
  92.     
  93.             call vectorplot(posns%(),reflec%,count%)
  94.             
  95.             count% = count%+1
  96.     
  97.         next vector%
  98.     
  99.         oldbase% = presntbase%
  100.     next itn%
  101.     
  102. next bio%
  103.  
  104. end sub