Authors
Publication
Pub Details
Date
Pages
All you need to start is a simple understanding of the PLOT command, says professor and author Michael K. Barnett in this exclusive interview.
Can you tell us some of the computers that you use for computer graphics?
These include some very large IBM machines like 370s, 3033s and 3081s, some personal computers like the Apple, and the Timex Sinclair 1000 home computer.
Does it make sense to use a T/S1000, ZX81 when you can use these larger machines?
Yes — a lot of sense. The T/S1000 and the large IBM machines are at opposite ends of what many people see as a unified scheme — for teaching and learning what computer graphics can be used to convey.
What are the limitations of T/S1OOO graphics and how do they affect the fields where T/S graphics will be used?
The limitations are the resolution that it can provide on the television screen, the amount of data that can be stored for reference, and the speed at which it calculates. However, I don’t see these locking the T/S 1000 out of particular fields where graphics are useful; within these fields, the Timex will be used where low resolution is adequate, perhaps as a preliminary to using higher quality equipment.
Where do you think Timex graphics will be used?
Education, business, research and engineering, and entertainment, for a start.
How will it be used in education?
Initially, to teach programming and computer literacy, to help teach math, to teach people how to use computer graphics in their work; as time goes on, in chemistry and other sciences, in social sciences and in educational ad¬ ministration.
How can it be used to teach programming?
Many people are afraid of computers because they are afraid of mathematics and formulas. And most people do not have ready access to a computer, or the money to spend on a terminal and phone bills. You can buy a T/S 1000 for the price of a couple of textbooks or a home appliance, and work with it in your own time and at your own pace in the comfort and privacy of your home. And the graphics let you start using commands based on the simple idea of using squared paper that people see around the house in patterns for knitting and laying tiles and so on.
You mean someone can get started just using the PLOT command?
Sure. After PLOTting a few points in the immediate mode to get a feel for the numbering, you can write simple programs with FOR loops to draw straight lines and make them move. For example, just type:
10 FOR X=10 TO 50
20 PLOT X,20
30 NEXT X
and you get a horizontal line about halfway down the screen. Change the numbers in the FOR statement, keeping between 0 and 63, and this changes the length of the line. Change the Y value in the PLOT statement from 20 to any other value between 0 and 43 and you change the height of the line. And to get a vertical line, you put Y in the FOR statement instead of X, and you change the PLOT statement to PLOT 20,Y to draw the line halfway across the screen.
What about sloping lines?
Easy. Try:
10 FOR N=0 TO 40
20 PLOT N,N
30 NEXT N
That slopes up from southwest to northeast.
And to get it to slope up from southeast to northwest?
Try:
10 FOR N=0 TO 40
20 PLOT 63-N,N
30 NEXT N
You can build lots of patterns using these tactics. Here is a simple example.
How many lines of code did this take?
This does it in 20 lines:
10 FOR K=1 TO 4
20 FOR X=32-2**K TO 32+2**K
30 PLOT X,21-2**K
40 PLOT X,21+2**K
50 NEXT K
60 FOR Y=22-2**K TO 20+2**K
70 PLOT 32-2**K,Y
80 PLOT 32+2**K,Y
90 NEXT Y
100 FOR X=33-2**K TO 31
110 PLOT X,X-11+2**K
120 PLOT X,53-X-2**K
130 NEXT X
140 FOR X=33 TO 32+2**K
150 PLOT X,53-X+2**K
160 PLOT X,X-11-2**K
170 NEXT X
180 NEXT K
190 POKE 16417,1
200 COPY
Perhaps your readers can shorten this or speed it up, for example by calculating 2**K just once in each cycle.
We’ll ask them. Timex graphics certainly let people learn about coordinates and FOR loops very quickly.
Yes. And about interactive design.
I thought that needed very expensive equipment. Isn’t that the sort of thing that car manufacturers do?
Try the following program. It won’t let you design a car, but it does illustrate the basic tactic of interactive design.
10 LET B$=" "
20 LET B$=B$+B$+B$+B$
30 PRINT AT 0,0;"XLO,XHI,Y: ";
40 INPUT XLO
50 INPUT XHI
60 INPUT Y
70 PRINT XLO;",";XHI;",";Y
80 FOR X=XLO TO XHI
90 PLOT X,Y
100 NEXT X
110 IF INKEY$<>"" THEN GOTO 110
120 PRINT AT 1,0;"PRESS K TO KEEP, E TO ERASE:";
130 IF INKEY$="" THEN GOTO 130
140 LET R$=INKEY$
150 PRINT R$
160 GOTO 300*(R$="K")+200*(R$="E")
170 PRINT AT 1,0;B$
180 GOTO 110
200 FOR X=XLO TO XHI
210 UNPLOT X,Y
220 NEXT
300 PRINT AT 0,0;B$;B$
310 GOTO 30
Statement 30 prompts for the values of X at the ends of the line you want the program to draw, and the value for Y. Statements 80 to 100 draw the line. Statement 110 waits if you are still pressing any keys. Statement 120 prompts you to show whether you want to keep the line or change your mind — this is what makes it interactive. Statements 200 to 220 erase the line if you request this. Then the cycle beings all over again.
And I can use the same principle to expand the program, to prompt the user to type, say, D for a dot. H for a horizontal line and V for a vertical line, followed by the coordinates…
Correct. The person learning can take off very quickly, varying and expanding the prototype programs for graphics.
Do these principles of graphics apply to larger machines?
Yes. Using the T/S1000, students and architects and fashion designers and planners can get a handle on writing prompting sequences at home. Then if they want larger or higher quality graphics, they can go to bigger machines and program these themselves or tell the programmers what to do.
Can you get animation effects on the T/S1000?
Yes. For example, patterns move up the screen by SCRGLLing. To see this, just type:
10 FOR N = 0 TO 63
20 SCROLL
30 PRINT TAB N; " "
40 NEXT N
50 GOTO 10
This seems to make lines of little darts shoot up.
I suppose if you turned the screen on its side you could get things to SCROLL sideways.
I would not recommend that with the family television set.
What if you want to draw a face with an eye that opens and shuts, or a caterpillar wriggling across the screen?
Easy. Many of the programs in my recent book Personal Graphics for Profit and Pleasure on the Apple II Plus Computer (with Graham K. Barnett; Little, Brown; $14.50) can be adapted to the T/S1000/ZXB1. “Winkface” draws a face and makes one eye wink. The outline of the eye is drawn first: on the Timex you just use PLOT commands. Then if the center of the eye is at position XC,YC you make it blink by statements like:
500 PLOT XC,YC
510 PAUSE 60
520 UNPLOT XC,YC
530 PAUSE 60
540 GOTO 500
This use of PLOT to draw and UNPLOT to erase, or its equivalent in other programming languages, is a basic tactic of animation. Try this ten-liner and meet Grenville the Graceful Grub:
10 FOR N=0 TO 7 STEP 2
20 PLOT N,20
30 PLOT N+1,21
40 NEXT N
50 FOR M=0 TO 54 STEP 2
60 UNPLOT M,20
70 PLOT M+8,20
80 UNPLOT M+1,21
90 PLOT M+9,21
100 NEXT M
He wiggles across the screen from left to right. And you can vary the program easily to make grubs of different lengths and shapes wiggle in different directions.
Here is a very different type of graphics demonstration — a very simple bar chart program:
10 LET B$ = " "
20 PRINT AT 0,0;"MAXIMUM VALUE: ";
30 INPUT MAXIMUMVALUE
40 PRINT MAXIMUMVALUE
50 LET Y=43
55 PAUSE 60
60 PRINT AT 0,0;B$;AT 0,0;‘‘CAPTION, VALUE: ";
70 INPUT C$
80 INPUT VALUE
90 PRINT C$;",";VALUE
100 LET Y=Y-2
110 IF Y<=0 OR VALUE>MAXIMUMVALUE THEN GOTO 1000
120 LET R=INT (.5+50*VALUE/MAXIMUMVALUE)
130 FOR X=1 TO R
140 PLOT X,Y
150 NEXT X
160 IF LEN C$)32-R/2 THEN LET C$=C$( TO 30-R/2)
170 PRINT " ";C$;"(";VALUE;")"
180 GOTO 60
1000 POKE 16417,1
1010 PRINT AT 0,0;B$
1020 COPY
It prompts for the maximum value to be represented horizontally. Then it prompts for the captions of the bars and the values these repre¬ sent. It draws and labels the bars and, when you want to quit, you just press ENTER, type a number greater than the maximum value you typed originally, and press ENTER again. Here is an example of its output:
Most of the examples you have given are charts and geometrical shapes and patterns. Don’t you feel hampered by the lack of pictorial realism?
I look on it rather as a challenge to find what can be conveyed without so-called realism. I think that a very sad aspect of high technology in general is that we vastly under-utilize the hardware, software, mathematics and very sophisticated techniques at our disposal. Part of the problem is that we haven’t learned how to make the most of simple resources.
Do you think the smallness of machines like the T/S1OOO will stimulate new research?
Yes.