home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug024.arc / GRAFALL.ASC < prev    next >
Text File  |  1979-12-31  |  3KB  |  67 lines

  1.                                 GRAFALL.MWB
  2.  
  3.      This file is included because of a fault in the original listing
  4.  
  5. 0010░ DI═ A(8),A0(200⌐   [181]
  6. 00110 A(0) = INT(RND*170)+20 : A(2) = INT (RND*2) : A(3) = INT (RND*3)   █▒▒▓▌
  7. 00120 A0(0) = RND*180  █▒░╡▌
  8. 00130 FOR I = 1 TO A(0)+1 : A0(I) = A0(I-1)+(RND*9)-5 : NEXT I    █▒╣╖▌
  9. 04000 REM The following routine will graph real numbers   █▒╣╢▌
  10. 04010 REM   from -99999 to +99999. Put data in variables :    █▒╣╖▌
  11. 04020 REM   a0(  )      Array containing the data   █▒╣╕▌
  12. 04030 REM   a(0)        No of data to be graphed -1   █▒╣╣▌
  13. 04040 REM   a(2)        1 = HIRES   0 = LORES   █▓░░▌
  14. 04050 REM   a(3)        0 = Bar   1 = Dot   2 = line graph   █▓░▒▌
  15. 04060 REM   █▓░▓▌
  16. 04070 A1 = 99999 : A7 = -99999   █▓░╕▌
  17. 04080 FOR I = 0 TO A(0)   █▓░╢▌
  18. 04090 IF A0(I) <A1 : A1 = A0(I) : REM find minimum   █░╢╖▌
  19. 04100 IF A0(I) >A7 : A7 = A0(I) : REM find maximum   █░╖│▌
  20. 04110 NEXT I   █░╖╕▌
  21. 04120 A2 = A7 - A1 : REM Range of values   █▓░░▌
  22. 04130 IF A2 = 0 : CURS 1,8 : PRINT"Data all equal " : PLAY 22; 0, 8 : 
  23.       GOTO 130   █░╣╣▌
  24. 04140 IF A(2) = 1 THEN 4160   █▒│▓▌
  25. 04150 CLS : LORES : A3 = 45 : A4 = 110 : GOTO4170   █▒▓┤▌
  26. 04160 CLS : HIRES : A3 = 250 : A4 = 450   █▒░╡▌
  27. 04170 A2 = A2/A3 : REM step factor vertical   █▓░┤▌
  28. 04180 A(4) = INT(A4/FLT(A(0))) : REM step factor horizontal   █▓▓╖▌
  29. 04190 IF A(4)<1 : CURS 1,8 : PRINT"Too many values" : PLAY 22; 0, 8 : 
  30.       GOTO 130   █░╖▓▌
  31. 04200 A(5) = INT(A4/8)+2 : REM Y axis   █▒▓▒▌
  32. 04210 PLOT A(5),INT(A3) TO A(5),0 : REM TO A(5)+INT(A4)+1,0 : 
  33.       REM print axes   █▒╢╣▌
  34. 04220 IF A1<-9999.9 OR A7>9999.9 THEN 4240   █░▓┤▌
  35. 04230 CURS 1,16 : PRINT [F7.1 A1]; : CURS 1,1 : PRINT [F7.1 A7] :
  36.       GOTO 4250   █▓│▓▌
  37. 04235 REM label axes   █▓░╢▌
  38. 04240 CURS 1,16 : PRINT [F7.0 A1]; : CURS 1,1 : PRINT [F7.0 A7] : 
  39.       GOTO 4250   █▓│▒▌
  40. 04250 A(6) = INT((A0(0)-A1)/A2) : REM 1st value for plot   █▓░▓▌
  41. 04260 ON A(3)+1 GOTO 4270, 4330, 4390   █▒│░▌
  42. 04265 REM                     Bar graph   █▓░╣▌
  43. 04270 FOR I = 0 TO A(0)   █▓░╖▌
  44. 04280 A(8) = I*A(4)+A(5)+1 : REM horizontal coordinate   █▒╡░▌
  45. 04290 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate   █▓│▓▌
  46. 04300 PLOT A(8),0 TO A(8),A(7)   █▒┤▓▌
  47. 04310 NEXT I   █░╕░▌
  48. 04320 GOTO 4450   █▓░╖▌
  49. 04325 REM                     Dot graph   █▓░╢▌
  50. 04330 FOR I = 0 TO A(0)   █▓░┤▌
  51. 04340 A(8) = I*A(4)+A(5)+1 : REM horizontal coordinate   █▒┤╖▌
  52. 04350 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate   █▓▓╣▌
  53. 04360 SET A(8),A(7)   █▒▓░▌
  54. 04370 NEXT I   █░╕╢▌
  55. 04380 GOTO 4450   █▓▒│▌
  56. 04385 REM                     Line graph   █▓▒▓▌
  57. 04390 FOR I = 1 TO A(0)   █▓▒▒▌
  58. 04400 A(8) = I*A(4)+A(5) : REM horizontal coordinate   █░╡▓▌
  59. 04410 A(7) = INT((A0(I)-A1)/A2) : REM vertical coordinate   █▓▓╢▌è04420 PLOT A(8),A(7) TO A(8)-A(4),A(6)   █░▓╕▌
  60. 04430 A(6) = A(7)   █▒╡│▌
  61. 04440 NEXT I   █░╕┤▌
  62. 04450 IF A1<0 AND A7>0 : PLOTI A(5)+1,INT(-A1/A2) TO INT(A4)+A(5)+1,
  63.       INT(-A1/A2): CURS 1,INT((16*A7)/(A7-A1))+1 : PRINT"   00.0"   █▓┤▓▌
  64. 04455 REM plot and label x axis if it is on screen   █▓▒░▌
  65. 04460 IF KEY <> " " THEN 4460   █░░▒▌
  66. 10000 GOTO 110    █▒╕╕▌
  67.