A CAI program called LINEAR EQUATION
Peter Oakes
Muskegon, MI
This article is about Computer-Assisted-Instruction or commonly called CAI programming. My example program is called LINEAR EQUATION. It is written for an 8K PET computer. Since it uses a minimum of graphics I believe it could be modified for many other small computers.
The Program Has These Features:
choice of using the computer monitor or a printer.
choice of 6 different randomly generated problems.
problem solutions complete with step by step procedures for solving.
Program Description
Lines 100-106 simply announces the program.
Line 108 makes the RND (random number generator) truly random for the "older" original ROM PETs.
Lines 110-122 asks if the user wants to use a printer. If this option is executed, then the problem question and solution (and procedure) will be written to the printer. Everything else is still done on the monitor. Figure 1 shows a sample output for a printer. Of course, a similar output would appear on the monitor if the printer option is not executed.
Lines 124-144 ask for the problem type the user wants generated. Line 144 forces the user to answer only with a 1, 2, 3, 4, 5,or 6. A similar control occurs in line 118 making sure the user answers with Y, N, or T.
Lines 146-168 gets the random data to generate the problems. Line 152 generates a random number V(I) in the range [-11.0 to + 11.0] excluding [-0.9 to + 0.9]
Lines 158-168 calculate specific problem data.
Example: XI = INT(-V(2)/V(1)*100 +.5)/100 calculates the x-intercept of a line rounded off to hundredths by the underlined portion of the statement.
Line 172 opens the PET to a device (ie: opens to write to the monitor or printer depending on the value of U8 from lines 114-116). Line 172 also clears the monitor if the printer is not used. Line 174 prints a "divider" between problems if a printer is used. Line 176 will GOTO the printing of the selected problem as does line 250 print the appropriate solution.
Lines 234-250 checks (on the monitor) to see if a solution is wanted.
Note that in the printing of signs care has been taken to print the appropriate - or + sign. An example is found in the subroutine at lines 402-406 (as used from line 264). If T had a value of -7.2, then the subroutine would make T$ be -7.2 whereas if T had a value of 7.2, then T$ would be made +7.2 which assures the correct printing of T$.
The rest of the program lines are unique to what each line does and would take too much space to explain every detail. I'll let the reader read those lines over on his own. I hope this program will be of value to the reader as CAI programs can be very helpful in mathematics. Figure 2 shows a complete listing of the program with graphics noted.
Figure 1