
See what a big difference the line spacing makes? All of the
multiple-line graphics programs in this manual use this line spacing.
Diamond pattern
In this next and final version of the program, you exercise even
more control over the slashes. This program varies not only their
direction, but also their sizes (length and height) on the print line.
Although the program still uses only one subroutine, it prints 24
different patterns, 12 on each of the 2 print lines. The differences in the
patterns are achieved by IF-THEN tests in a subroutine.
To get the final listing, add line
100
and change lines
10, 30, 40, 50,
80, 90, and 120:
10 LPRINT CHR$(27)"1"
20 FOR L=1 TO 2
30 FOR J=0 TO 1
40 LPRINT CHR$(27)"K"CHR$(27)CHR$(0);
50 GOSUB 80
60 NEXT J: LPRINT: NEXT L
70 LPRINT CHR$(27)"@": END
80 FOR X=1 TO 6: Y=X: IF J=1 THEN Y=7-X
90 FOR Z=0 TO Y: N=Z: IF J=1 THEN N=Y-Z
100 IF L=2 THEN N=7-N
110 LPRINT CHR$(2^N);
120 NEXT Z: NEXT X: RETURN
If you didn’t watch the printing when you ran this program, the
printout may not make it obvious that there are two lines of print-
but there are. The first line prints slashes by moving from bottom to
top and then from top to bottom, whereas the second line prints the
slashes first from top to bottom and then from bottom to top.
And how do the IF-THEN statements fit into the picture? The one in
line 80 changes the length of the slashes. The one in line 90 controls the
direction and height. The IF-THEN in line
100
makes the bottom row
a mirror image of the top.
141