home *** CD-ROM | disk | FTP | other *** search
-
- ~ Plot Hilbert curves.
- ~ Reference: Algorithms + Data Structures = Programs, pp. 132-3
-
- 200 d: ~ set delay parameter. This is for 486DX2/50 under Myz80.
- ~ use smaller value for slower machines.
-
- 26 !' #S,d.
- 5 f:
- (
- #P,12,24;
- " HC.MSE"
- #S,d.;
- 26 !' ~ Clear the screen
- #S,d.;
- f. 1 - f :
- f. ^
- )
-
- 26 !'
- #P,12,24;
- " Hilbert Curves !"
- #S,d.7*; ~ Pause a while
- '. G : ~ Specify plotting graphic
- 64 H : 16 K : ~ Unit frame
- 0 I :
- 40 A : 12 B : ~ Mid-screen position
-
- 26 !'
-
- #P,23,4;
- "How many Hilbert curves do you want to plot ? (1..5) " ? N :
-
-
- ( 26 !' ~ Clear the screen
- I. 1 + I : "H"I.! ~ before new curve is drawn
- H. 2 / H : K. 2 / K :
- A. H. 2 / + A :
- B. K. 2 / + B :
- A. X : B. Y :
- #P,Y.,X.;
- A. V : B. W :
- #A,I.;
- #S,d.7*; ~ Sit back and admire for
- N. I. - ^ ~ a while
- )
- 26 !' ~ Clear the screen when done
-
- $P ~ Position the cursor at row 1% column 2%
-
- 27 !' '= !'
- 1% 1 - 32 + !'
- 2% 1 - 32 + !'
-
- @
-
- $A 1%
- [ #D,1% 1 -; X. H. - X : #T;
- #A,1% 1 -; Y. K. - Y : #T;
- #A,1% 1 -; X. H. + X : #T;
- #B,1% 1 -;@]@
-
- $B 1%
- [ #C,1% 1 -; Y. K. + Y : #T;
- #B,1% 1 -; X. H. + X : #T;
- #B,1% 1 -; Y. K. - Y : #T;
- #A,1% 1 -;@]@
-
- $C 1%
- [ #B,1% 1 -; X. H. + X : #T;
- #C,1% 1 -; Y. K. + Y : #T;
- #C,1% 1 -; X. H. - X : #T;
- #D,1% 1 -;@]@
-
- $D 1%
- [ #A,1% 1 -; Y. K. - Y : #T;
- #D,1% 1 -; X. H. - X : #T;
- #D,1% 1 -; Y. K. + Y : #T;
- #C,1% 1 -;@]@
-
- $T V. v: W. w : ~ Plot from (V,W) to (X,Y)
-
- (X. v. - ^ G. !' v. 1 + v : #P,w.,v.;) X. V. -[X.V:@]
- (v. X. - ^ G. !' v. 1 - v : #P,w.,v.;) V. X. -[X.V:@]
- (Y. w. - ^ G. !' w. 1 + w : #P,w.,v.;) Y. W. -[Y.W:@]
- (w. Y. - ^ G. !' w. 1 - w : #P,w.,v.;) W. Y. -[Y.W:@]
-
- $S 1% w: ( w. 1 - w: w. ^) @ ~ Pause 1% units
-