home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / mouse-ex.lbr / HC.MZE / HC.MSE
Encoding:
Text File  |  1993-02-22  |  2.1 KB  |  90 lines

  1.  
  2. ~ Plot Hilbert curves.
  3. ~ Reference: Algorithms + Data Structures = Programs, pp. 132-3
  4.  
  5. 200 d: ~ set delay parameter. This is for 486DX2/50 under Myz80.
  6.        ~ use smaller value for slower machines. 
  7.  
  8. 26 !' #S,d.
  9. 5 f:
  10. (
  11. #P,12,24;
  12. "                     HC.MSE"
  13. #S,d.;
  14. 26 !'   ~ Clear the screen
  15. #S,d.;
  16. f. 1 - f :
  17. f. ^
  18. )
  19.  
  20. 26 !'
  21. #P,12,24;
  22. "                    Hilbert Curves !"
  23. #S,d.7*;                              ~ Pause a while
  24. '. G :                                ~ Specify plotting graphic
  25. 64 H : 16 K :                         ~ Unit frame
  26. 0 I :
  27. 40 A : 12 B :                         ~ Mid-screen position
  28.  
  29. 26 !'
  30.  
  31. #P,23,4;
  32. "How many Hilbert curves do you want to plot ? (1..5) " ? N :
  33.  
  34.  
  35. ( 26 !'                               ~ Clear the screen
  36.   I. 1 + I : "H"I.!                   ~ before new curve is drawn
  37.   H. 2 / H :  K. 2 / K :
  38.   A. H. 2 / + A :
  39.   B. K. 2 / + B :
  40.   A. X : B. Y :
  41.   #P,Y.,X.;
  42.   A. V : B. W :
  43.   #A,I.;
  44.   #S,d.7*;                            ~ Sit back and admire for
  45.   N. I. - ^                           ~ a while
  46. )
  47. 26 !'                                 ~ Clear the screen when done
  48.  
  49. $P ~ Position the cursor at row 1% column 2%
  50.  
  51.  27 !' '= !'
  52.  1% 1 - 32 + !'
  53.  2% 1 - 32 + !'
  54.  
  55. @
  56.  
  57. $A 1%
  58. [ #D,1% 1 -; X. H. - X : #T;
  59.   #A,1% 1 -; Y. K. - Y : #T;
  60.   #A,1% 1 -; X. H. + X : #T;
  61.   #B,1% 1 -;@]@
  62.  
  63. $B 1%
  64. [ #C,1% 1 -; Y. K. + Y : #T;
  65.   #B,1% 1 -; X. H. + X : #T;
  66.   #B,1% 1 -; Y. K. - Y : #T;
  67.   #A,1% 1 -;@]@
  68.  
  69. $C 1%
  70. [ #B,1% 1 -; X. H. + X : #T;
  71.   #C,1% 1 -; Y. K. + Y : #T;
  72.   #C,1% 1 -; X. H. - X : #T;
  73.   #D,1% 1 -;@]@
  74.  
  75. $D 1%
  76. [ #A,1% 1 -; Y. K. - Y : #T;
  77.   #D,1% 1 -; X. H. - X : #T;
  78.   #D,1% 1 -; Y. K. + Y : #T;
  79.   #C,1% 1 -;@]@
  80.  
  81. $T  V. v:  W. w :                     ~ Plot from (V,W) to (X,Y)
  82.  
  83. (X. v. - ^ G. !' v. 1 + v : #P,w.,v.;) X. V. -[X.V:@]
  84. (v. X. - ^ G. !' v. 1 - v : #P,w.,v.;) V. X. -[X.V:@]
  85. (Y. w. - ^ G. !' w. 1 + w : #P,w.,v.;) Y. W. -[Y.W:@]
  86. (w. Y. - ^ G. !' w. 1 - w : #P,w.,v.;) W. Y. -[Y.W:@]
  87.  
  88. $S 1% w: ( w. 1 - w: w. ^) @            ~ Pause 1% units
  89.  
  90.