4 KEY (9) ON:KEY(10) ON: ON KEY(9) GOSUB 55000: ON KEY(10) GOSUB 55020
5 COMMON N$,CHN.LOC!
6 GOSUB 55100
8 CLS:FOR I=1 TO 10:KEY I,"":NEXT
9 '
10 '*******************************
11 '* Graphing Linear Functions *
12 '* *
13 '* By the Owego Translators *
14 '* *
15 '* Copyright 1984 *
16 '* Microcomputer Workshops *
17 '*-----------------------------*
18 '* Extensively Revised & *
19 '* Debugged by Kevin Vessio *
20 '* 2/8/85 *
21 '*******************************
22 '
100 GOSUB 50000 ' Introduction
120 GOSUB 47100 ' Data
150 GOSUB 51000 ' Get name
790 ' ***************
792 ' * Main Menu *
794 ' ***************
800 CLS:LOCATE 4,16:DEF SEG:POKE &H4E,1:PRINT"M E N U":PRINT TAB(16)STRING$(7,174):LOCATE 8,2:POKE &H4E,3:PRINT"<1> Instructions":PRINT:PRINT" <2> Easy problems (in the form y=mx+b)"
805 PRINT:PRINT" <3> Hard problems (other forms)":PRINT:PRINT" <4> Mixed problems":PRINT:PRINT" <5> Exit the program"
10120 LOCATE 10,1:IF TY%<>1 AND B%<>0 THEN PRINT " The first step in graphing this":PRINT :PRINT "equation is to solve it for y.":SV$="y":GOTO 10160
10130 IF B%=0 AND TY%<>1 THEN LOCATE 5,1:PRINT " Well, "N$", this problem is an":PRINT :PRINT "unusual one. Normally, you would solve":PRINT :PRINT "the original equation for Y; but Y":PRINT :PRINT "doesn't appear in this equation, so you":PRINT
10140 IF B%=0 AND TY%<>1 THEN PRINT "solve for x instead.":SV$="x"
10150 IF LS$="x" THEN 10170
10160 IF TY%<>1 THEN GOSUB 15000: LOCATE 3,1:GOSUB 35000:LOCATE 4,1:GOSUB 25000
10170 GOSUB 15000
10180 GOSUB 23000 ' graph equation
10190 RETURN
10990 ' ****************************
10992 ' * Solve for three values *
10994 ' ****************************
11000 GOSUB 30000:PRINT " Now you must find three points on":PRINT :PRINT "the line. Don't forget to choose points":PRINT "that fit on our graph and have integral":PRINT :PRINT "coordinates.":GOSUB 15000:GOSUB 30000
11010 FOR PP=1 TO 3:WR=0
11020 GOSUB 30000:PRINT "Enter the ";IV$;" coordinate: ";:GOSUB 22000
11030 GOSUB 30000
11040 T5%=VAL(ZZ$)
11050 IF ABS(T5%)>= TC% THEN GOSUB 30000:PRINT" I'm sorry, ";N$;", but the graph":PRINT:PRINT"we use only fits points with":PRINT:PRINT "coordinates between ";1-TC%;"and ";FN NUMSIGN$(TC%-1,1);".":GOSUB 15000:GOSUB 30000:E2%=E2%+1:GOTO 11020
11060 IF (PP>1 AND T5%=P%(1,1-(B%=0))) OR (PP=3 AND T5%=P%(2,1-(B%=0))) THEN GOSUB 30000:PRINT " Choose a different value. You":PRINT :PRINT "already used that one.":GOSUB 15000:GOSUB 30000:GOTO 11020
11070 IF A%=0 THEN 11220
11080 IF B%=0 THEN 11230
11090 VA$="":TE$=FN NUMSIGN$(T5%,1):IF RX%(0)<>RX%(1) THEN CO%(0)=RX%(0):CO%(1)=RX%(1):GOSUB 19000:TE$="("+FN SIGNSTR$(RE$)+")("+TE$+")"
11100 IF C% THEN TE$=TE$+S.SIGNS$(FN NEG(C%/B%))+FN RIGHTOF$(STR$(C%/B%))
11110 IF NOT FN WH(T5%*A%/B%) THEN GOSUB 30000:PRINT " That's a poor choice, ";N$;".":PRINT :PRINT "If ";IV$;" is ";FN NUMSIGN$(T5%,1);", then ";DV$;" will not be":PRINT :PRINT "an integer.":GOTO 11140
11120 IF ABS ((C%-A%*T5%)/B%)>= TC% THEN GOSUB 30000:PRINT " We can't plot that, "N$".":PRINT :PRINT "If "IV$" is ";FN NUMSIGN$(T5%,1);", then "DV$" will not be in the":PRINT :PRINT "range "1-TC%"to "FN NUMSIGN$(TC%-1,1)".":GOTO 11140
11145 GOSUB 30000:PRINT" Use zero or a number that is":PRINT:PRINT"divisible by the denominator of the":PRINT:PRINT"coefficient of x.":GOSUB 15000:GOTO 11020
12050 LOCATE 13,24:PRINT "Press ";:DEF SEG:POKE &H4E,1:PRINT "ENTER";:POKE &H4E,3:PRINT " when";:LOCATE 14,24:PRINT "the cursor is on":LOCATE ,24:PRINT "the right point."
14030 FOR ZZ=13 TO 15:LOCATE ZZ,24:PRINT STRING$(16,32);:NEXT:GOSUB 31000:E3%=E3%+1
14040 IF X%=CY% AND Y%=CX% THEN PRINT " That's close, ";N$;"; but it looks":LOCATE 22,1:PRINT "like you've mixed up x and y. You":PRINT "plotted ";:DX%=X%:DY%=Y%:GOSUB 36000:PRINT ".":GOTO 14080
14050 IF ABS(X%)=ABS(CX%) AND ABS(Y%)=ABS(CY%) THEN PRINT " You're not too far off, ";N$;".":PRINT "You just have to keep better track of":PRINT "signs. You found ";:DX%=X%:DY%=Y%:GOSUB 36000:PRINT ".":GOTO 14080
14060 PRINT " You've made a mistake, ";N$;".":PRINT "The point you plotted is ";:DX%=X%:DY%=Y%:GOSUB 36000:PRINT "."
14130 IF H1% THEN LOCATE 19,24:POKE &H4E,1:PRINT "Cursor:";:POKE &H4E,3
14140 GOSUB 12050:GOSUB 13000: IF X%=CX% AND Y%=CY% THEN 14230
14150 E3%=E3%+1:FOR ZZ=13 TO 15:LOCATE ZZ,24:PRINT STRING$(16,32);:NEXT
14160 GOSUB 31000:PRINT " Sorry ";N$;", that's still not":PRINT "right. You plotted ";:DX%=X%:DY%=Y%:GOSUB 36000:PRINT ".":GOSUB 15000:GOSUB 31000
14170 PUT(FN HC(X%)-4,FN VC(Y%)-4),X.MARK#:PRINT " Let me show you the point you should":PRINT "be plotting.":GOSUB 15000
14180 GOSUB 31000:PRINT:PRINT " Look carefully and you'll see it."
14190 FOR ZZ=1 TO 30:PUT(FN HC(CX%)-4,FN VC(CY%)-4),P.POINT#
14200 FOR ZZZ=1 TO 20:NEXT ZZZ
14210 NEXT ZZ
14220 GOSUB 31000:PRINT:PRINT " Okay ";N$;", now you find it.":GOTO 14120
14230 PUT(FN HC(X%)-4,FN VC(Y%)-4),X.MARK#:GOSUB 31000: ON FN R(3) GOTO 14240,14250:PRINT " Good work, ";N$;".":PRINT "You found the right point.":GOTO 14260
14240 PRINT " Brilliant job, ";N$;".":PRINT "That's the point you were looking for.":GOTO 14260
14250 PRINT " Excellent, ";N$;".":PRINT "There's the point you wanted."
17100 IF NOT MG% THEN FOR ZZ=1-TC% TO TC%-1:LINE(FN HC(ZZ),FN VC(0)-4)-(FN HC(ZZ),FN VC(0)+4),1:LINE (FN HC(0)-4,FN VC(ZZ))-(FN HC(0)+4,FN VC(ZZ)),1:NEXT ZZ:GOTO 17120
17110 FOR ZZ=1 TO TC%: LINE (FN HC(-ZZ),FN VC(TC%))-(FN HC(ZZ),FN VC(-TC%)),1,B:LINE(FN HC(-TC%),FN VC(ZZ))-(FN HC(TC%),FN VC(-ZZ)),1,B:NEXT ZZ
17170 IF MG% THEN LINE(FN HC(0),14)-(FN HC(TC%),14),1:LINE (FN HC(0),0)-(FN HC(TC%),0),1:LINE (FN HC(1),FN VC(TC%))-(FN HC(1),FN VC(-TC%)),1
17180 IF MG% THEN LINE(FN HC(-TC%),FN VC(TC%))-(FN HC(-TC%),FN VC(-TC%)),1:LINE (FN HC(1),FN VC(-4))-(FN HC(4),FN VC(-4)),1:LINE (FN HC(1),FN VC(-6))-( FN HC(4),FN VC(-6)),1
17190 RETURN
17990 ' ****************************
17992 ' * Enter monomial routine *
17994 ' ****************************
18000 REM Get monomial from user.
18010 G$="":G1$="":VA$=""
18020 T3%=CSRLIN:T4%=POS(0)
18100 LOCATE T3%,T4%:PRINT G$;" ";CHR$(29);
18110 GOSUB 28900:G1$=IN$
18115 IF G1$>="A" AND G1$<="Z" THEN G1$=CHR$(ASC(G1$)+32)
18120 IF ((G1$<"0" OR G1$>"9") AND G1$<>CHR$(13) AND G1$<> CHR$(8) AND (G1$<>"-" OR G$<>"") AND (G1$<>"x" AND G1$<>"y" OR VA$<>"") AND (G1$<>"/" OR G$="")) OR (VA$<>"" AND G1$<>"/" AND G1$<> CHR$(13) AND G1$<>CHR$(8)) THEN 18110
18125 IF ABS( VAL (G$+G1$)) > 1000 THEN 18110
18126 IF G$="-" AND G1$="0" THEN 18110:ELSE IF G$="0" AND G1$<>CHR$(8) AND G1$<>CHR$(13) THEN 18110
18130 IF G1$<>CHR$(13) THEN 18160
18135 IF G$="" OR G$="-" THEN 18110
18140 IF G$="x" OR G$="y" THEN NU%=1:DE%=NU%:RETURN
18142 IF G$="-x" OR G$="-y" THEN NU%=-1:DE%=1:RETURN
18145 IF G$="" THEN 18110
18150 NU%=VAL(LEFT$(G$,LEN(G$))):DE%=1:RETURN
18160 IF G1$<>"/" THEN 18185
18165 IF G$="" OR G$="-" THEN 18110
18170 IF G$="x" OR G$="y" THEN NU%=1:GOTO 18500
18172 IF G$="-x" OR G$="-y" THEN NU%=-1:DE%=1:GOTO 18500
18180 NU%=VAL(LEFT$(G$,LEN(G$))):GOTO 18500
18185 IF G1$="x" OR G1$="y" THEN VA$=G1$
18190 IF G1$<>CHR$(8) THEN G$=G$+G1$:GOTO 18100
18200 IF LEN(G$)<2 THEN G$="":VA$="":GOTO 18100
18220 IF RIGHT$(G$,1)="x" OR RIGHT$(G$,1)="y" THEN VA$=""
18230 G$=LEFT$(G$,LEN(G$)-1):GOTO 18100
18500 D$=""
18510 LOCATE T3%,T4%:DE%=VAL(D$):IF DE% THEN IF LEFT$(G$,1)="-" THEN PRINT "-";
18515 IF DE% THEN GOSUB 18700:PRINT "/";:GOSUB 18800:PRINT " ";:GOTO 18530
18520 IF LEFT$(G$,1)="-" THEN PRINT "-";
18525 GOSUB 18700:PRINT "/ ";
18530 GOSUB 28900:G1$=IN$
18532 G1$=CHR$(ASC(G1$)-32*(G1$>="A" AND G1$<="Z"))
18535 IF (G1$<"0" OR G1$>"9") AND (G1$<>CHR$(13) OR DE%=0) AND (G1$<>"-" OR G$<>"") AND G1$<>CHR$(8) AND (G1$<>"x" AND G1$<>"y" OR DE%=0 OR VA$<>"") THEN 18530
18540 IF G1$=CHR$(13) THEN RETURN
18545 IF ABS(VAL(D$+G1$))>1000 THEN 18530
18547 IF G1$="x" OR G1$="y" THEN VA$=G1$:GOTO 18600
18549 IF G1$="0" AND D$="" THEN 18530
18550 IF G1$<> CHR$(8) THEN D$=D$+G1$:GOTO 18510
18560 IF D$="" THEN 18100
18570 IF LEN(D$) = 1 THEN PRINT CHR$(29)" "CHR$(29);:D$="":GOTO 18510
18615 IF G1$<>CHR$(13) AND G1$<>CHR$(8) THEN 18610
18620 IF G1$=CHR$(13) THEN RETURN
18630 VA$="":PRINT STRING$(3,29)" ";:GOTO 18510
18700 REM Print out G$ in upper chars
18705 FOR I=1 TO LEN(G$)
18707 IF MID$(G$,I,1)="-" THEN 18750
18710 IF MID$(G$,I,1)="y" THEN PRINT CHR$(175);:GOTO 18750
18715 IF MID$(G$,I,1)="x" THEN PRINT CHR$(ASC(MID$(G$,I,1))+75);:GOTO 18750
18720 PRINT CHR$(VAL(MID$(G$,I,1))+185);
18750 NEXT
18760 RETURN
18800 REM Print out DE% in lower chars
18805 TEMP$=STR$(DE%):FOR I=1 TO LEN(TEMP$)
18810 IF INSTR(" -",MID$(TEMP$,I,1))<>0 THEN 18850
18815 IF MID$(TEMP$,I,1)="0" THEN PRINT CHR$(137);:GOTO 18850
18820 PRINT CHR$(VAL(MID$(TEMP$,I,1))+127);
18850 NEXT
18860 RETURN
18989 ' ****************************************
18990 ' * Make fraction from CO%(0-1) into RE$ *
18992 ' * Reduce if RD% is non-zero *
18994 ' ****************************************
19000 IF CO%(0)*CO%(1) >= 0 THEN SI$=" + " ELSE SI$=" - "
19010 IF CO%(0)/CO%(1) <> INT(CO%(0)/CO%(1)) THEN 19100
19020 RE$="":TEMP%=ABS(CO%(0)/CO%(1))
19030 IF VA$="" THEN RE$=FN RIGHTOF$(STR$(TEMP%)): ELSE IF TEMP%=1 THEN RE$=VA$: : ELSE IF TEMP% > 0 THEN RE$=FN RIGHTOF$(STR$(TEMP%))+VA$:ELSE RE$=STR$(TEMP%)+VA$
19040 RETURN
19100 IF RD%=0 THEN 19130
19110 FOR ZZ=ABS(CO%(1)) TO 2 STEP -1:IF CO%(0)/ZZ=CO%(0)\ZZ AND CO%(1)/ZZ=CO%(1)\ZZ THEN CO%(0)=CO%(0)/ZZ:CO%(1)=CO%(1)/ZZ
19205 IF D%=137 AND MID$(TEMP$,I%,1)="0" THEN RE$=RE$+CHR$(185):GOTO 19220
19210 RE$=RE$+CHR$(VAL(MID$(TEMP$,I%,1))+N.O.D%)
19220 NEXT I%
19230 RETURN
19990 ' ***********************
19992 ' * Print an equation *
19994 ' ***********************
20000 CX%(0)=LX%(0):CX%(1)=LX%(1):CY%(0)=LY%(0):CY%(1)=LY%(1):CC%(0)=LC%(0):CC%(1)=LC%(1):MP%=LMP%:GOSUB 20500:LS$=E$ ' Make left side
20010 CX%(0)=RX%(0):CX%(1)=RX%(1):CY%(0)=RY%(0):CY%(1)=RY%(1):CC%(0)=RC%(0):CC%(1)=RC%(1):MP%=RMP%:GOSUB 20500 ' Make right side
20015 IF EXIT.TOG% THEN 20040
20020 LOCATE VP%,1:PRINT STRING$(40,32);
20025 PROB$=LS$+" = "+E$:IF START%=1 THEN TBP=INSTR(PROB$,"=")+FN MID(PROB$)-2
20026 IF LO%=1 THEN LOCATE VP%,TBP-LEN(LS$):ELSE LOCATE VP%,FN MID(PROB$)
20030 PRINT PROB$
20040 RETURN
20400 ' ***********************************
20410 ' * Create one side of the equation *
20420 ' ***********************************
20500 E$="":O.P%=0 ' signifies open parenthesis if true
20503 ' ** Put multiplier in position 1
20510 IF MP%=1 THEN IF DIV% THEN E$="(":O.P%=-1:ELSE VA$="":CO%(0)=MC%(0):CO%(1)=MC%(1):GOSUB 19000:E$="("+FN SIGNSTR$(RE$)+")(":O.P%=-1
20515 ' ** Create old X term (plus added X term if present)
20520 IF CX%(0)<>0 THEN VA$="x":CO%(0)=CX%(0):CO%(1)=CX%(1):GOSUB 19000:E$=E$+FN SIGNSTR$(RE$)
20530 IF AX%(0)<>0 THEN VA$="x":CO%(0)=AX%(0):CO%(1)=AX%(1):GOSUB 19000:IF CX%(0)<>0 THEN E$=E$+SI$+RE$:ELSE E$=E$+FN SIGNSTR$(RE$)
20540 ' ** Put multiplier in position 2
20600 IF MP%=2 THEN IF DIV% AND E$<>"" THEN E$=E$+"+(":O.P%=-1:ELSE IF DIV% THEN E$="(":O.P%=-1:ELSE VA$="":CO%(0)=MC%(0):CO%(1)=MC%(1):GOSUB 19000:IF E$="" THEN E$="("+RE$+")(":O.P%=-1:ELSE E$=E$+"+("+FN SIGNSTR$(RE$)+")(":O.P%=-1
20620 ' ** Put in the Y term
20630 IF CY%(0)<>0 THEN VA$="y":CO%(0)=CY%(0):CO%(1)=CY%(1):GOSUB 19000:IF E$="" OR RIGHT$(E$,1)="(" THEN E$=E$+FN SIGNSTR$(RE$):ELSE E$=E$+SI$+RE$
20640 ' ** Put in the added Y term if present
20650 IF AY%(0)<>0 THEN VA$="y":CO%(0)=AY%(0):CO%(1)=AY%(1):GOSUB 19000:IF E$="" OR RIGHT$(E$,1)="(" THEN E$=E$+FN SIGNSTR$(RE$):ELSE E$=E$+SI$+RE$
20700 ' ** Put divisor or constant multiplier on the end
20710 IF MP%=3 THEN IF DIV% AND E$<>"" THEN E$=E$+"+(":O.P%=-1:ELSE IF DIV% THEN E$="(":O.P%=-1:ELSE VA$="":CO%(0)=MC%(0):CO%(1)=MC%(1):GOSUB 19000:IF E$="" THEN E$="("+FN SIGNSTR$(RE$)+")(":O.P%=-1:ELSE E$=E$+"+("+FN SIGNSTR$(RE$)+")(":O.P%=-1
20720 ' ** Add in constant factor
20730 IF CC%(0)<>0 THEN VA$="":CO%(0)=CC%(0):CO%(1)=CC%(1):GOSUB 19000:IF E$="" OR RIGHT$(E$,1)="(" THEN E$=E$+FN SIGNSTR$(RE$):ELSE E$=E$+SI$+RE$
20735 ' ** Tag on added constant factor if present
20740 IF AC%(0)<>0 THEN VA$="":CO%(0)=AC%(0):CO%(1)=AC%(1):GOSUB 19000:IF E$="" OR RIGHT$(E$,1)="(" THEN E$=E$+FN SIGNSTR$(RE$):ELSE E$=E$+SI$+RE$
20750 IF RIGHT$(E$,1)="(" THEN E$=E$+"0":O.P%=-1
20770 IF MP% AND DIV% THEN CO%(0)=MC%(0):CO%(1)=MC%(1):VA$="":GOSUB 19000:E$=E$+")/("+FN SIGNSTR$(RE$)+")":O.P%=0:GOTO 20800
20780 IF O.P% THEN E$=E$+")"
20800 IF E$="" THEN E$="0"
20805 RETURN
20990 ' ***********************************
20992 ' * Plot points and Draw the line *
20994 ' ***********************************
21000 FOR P=1 TO 3:CX%=P%(P,1):CY%=P%(P,2):GOSUB 14000:GOSUB 15000:GOSUB 31000:NEXT P
21010 PRINT " Good job, ";N$;". You found all":PRINT "three points. Now it's time to draw theline.":GOSUB 15000:GOSUB 31000
21020 LOCATE 7,24:LINE(144,55)-(144,200),0,BF
21030 MG%=0:GOSUB 17000:FOR ZZ=1 TO 3:PRESET(FN HC(P%(ZZ,1)),FN VC(P%(ZZ,2))):DRAW "c2"+OBJ.FOU$:NEXT ZZ
21040 GOSUB 31000:PRINT " Okay, ";N$;". Now I'm ready to":PRINT "finish the graph by drawing a line":PRINT "through the three points you plotted.":GOSUB 15000:GOSUB 31000
25200 IF IV% THEN PRINT " That's not a good idea, ";N$;".":PRINT :PRINT "Now that you have the ";SV$;" term alone,":PRINT :PRINT "you should eliminate the coefficient of":PRINT :PRINT SV$;" by using multiplication or division."
25210 IF IV% THEN GOSUB 15000:GOSUB 30000:E1%=E1%+1:GOTO 25100
25220 IF CH=1 THEN OP$=" add ":COP$="Add":PR$="Add to both sides: ":TF$=" to ":SI%=1: ELSE OP$=" subtract ": COP$="Subtract":PR$="Subtract from both sides: ":TF$=" from ":SI%=-1
25230 GOSUB 26000
25240 GOTO 25100
25290 ' *****************************************
25292 ' * Set up variables for MULT or DIVIDE *
25294 ' *****************************************
25300 IF CH=3 THEN DEF FN MD(X)=X:OP$=" multiply ":COP$="Multiply":PR$="Multiply both sides by: ":ELSE DEF FN MD(X)=1/X:OP$=" divide ":COP$="Divid":PR$="Divide both sides by: "
25510 PRINT "You have solved the original equation":PRINT
25515 PRINT "for "SV$;:PRINT ". You're done with the first step.";
25520 RETURN
25590 ' ******************************
25592 ' * Addition and Subtraction *
25594 ' ******************************
26000 LOCATE 18,1:PRINT PR$;:GOSUB 18000:IF G$="" THEN GOSUB 30000:GOTO 26000
26110 IF NU%=0 THEN GOSUB 30000:LOCATE 18,1:PRINT " ";COP$;"ing zero";TF$;"both sides":PRINT :PRINT "will have no effect on the equation.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
26120 IF VA$=SV$ AND (RX%(0) OR RY%(0) OR RC%(0)) THEN GOSUB 30000:GOTO 26122
26121 GOTO 26130
26122 LOCATE 18,1:PRINT " I disagree, ";N$;". Moving the":PRINT :PRINT SV$" term will not help to simplify":PRINT :PRINT "the equation.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:GOTO 26000
26130 IF NOT((VA$=SV$ AND ABS(LSV%(0)/LSV%(1)+SI%*NU%/DE%)>9.9999E-05) OR (VA$=OV$ AND ABS(LOV%(0)/LOV%(1)+SI%*NU%/DE%)>9.9999E-05)) THEN 26170
26140 IF (VA$="x" AND (LX%(0)=0)) OR (VA$="y" AND (LY%(0)=0)) THEN GOSUB 30000 :LOCATE 18:PRINT " I wouldn't do that, ";N$;".":PRINT :PRINT "There's no "VA$" term on the left side for":PRINT :PRINT "you to move."
26141 IF (VA$="x" AND (LX%(0)=0)) OR (VA$="y" AND (LY%(0)=0)) THEN GOSUB 15000:GOSUB 30000:E1%=E1%+1:GOTO 26000
26150 GOSUB 30000:LOCATE 18:PRINT " That won't work, ";N$;". To move":PRINT :PRINT "the ";VA$;" term, you must";OP$;:CO%(0)=-SI%*LSV%(0):CO%(1)=LSV%(1):IF VA$=OV$ THEN CO%(0)=-SI%*LOV%(0):CO%(1)=LOV%(1)
26170 IF VA$<>"" OR ABS (LC%(0)/LC%(1)+SI%*NU%/DE%)<9.9999E-05 THEN 26500
26180 IF NOT (LC%(0)<>0) THEN GOSUB 30000:LOCATE 18:PRINT " That won't do much good, ";N$;".":PRINT :PRINT "There's no constant term on the left":PRINT :PRINT "side for you to move.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:GOTO 26000
26190 GOSUB 30000:LOCATE 18,1:PRINT " That's not right, "N$".":PRINT:PRINT"To move the constant term, you must":PRINT:PRINT MID$(OP$,2);:CO%(0)=-SI%*LC%(0):CO%(1)=LC%(1):GOSUB 19000:PRINT FNSIGNSTR$(RE$);TF$"both sides.":GOSUB 15000:GOSUB 30000
26195 E1%=E1%+1:GOTO 26000
26500 IF VA$="x" THEN AX%(0)=SI%*NU%:AX%(1)=DE%:L%(0)=LX%(0):L%(1)=LX%(1):R%(0)=RX%(0):R%(1)=RX%(1):GOTO 26550
26510 IF VA$="y" THEN AY%(0)=SI%*NU%:AY%(1)=DE%:L%(0)=LY%(0):L%(1)=LY%(1):R%(0)=RY%(0):R%(1)=RY%(1):GOTO 26550
26520 IF VA$="" THEN AC%(0)=SI%*NU%:AC%(1)=DE%:L%(0)=LC%(0):L%(1)=LC%(1):R%(0)=RC%(0):R%(1)=RC%(1):GOTO 26550
26560 GOSUB 30000:LOCATE 18,1:PRINT " Now you must simplify by combining":PRINT :PRINT "any like terms.":GOSUB 15000:GOSUB 30000
26580 A%(0)=SI%*NU%:A%(1)=DE%
26590 S%(1)=L%(1)*A%(1):S%(0)=L%(0)*A%(1)+A%(0)*L%(1):FOR ZZ=S%(1) TO 2 STEP -1:IF FN WH(S%(0)/ZZ) AND FN WH(S%(1)/ZZ) THEN S%(0)=S%(0)/ZZ:S%(1)=S%(1)/ZZ
26702 S%(1)=R%(1)*A%(1):S%(0)=R%(0)*A%(1)+A%(0)*R%(1):FOR ZZ=S%(1) TO 2 STEP -1:IF FN WH(S%(0)/ZZ) AND FN WH(S%(1)/ZZ) THEN S%(0)=S%(0)/ZZ:S%(1)=S%(1)/ZZ
26703 NEXT ZZ
26705 PRINT " Now combine like terms on the right":PRINT :PRINT "side of the equation.":GOSUB 15000:GOSUB 30000
26730 IF VA$=S$ AND ABS(NU%/DE%-S%(0)/S%(1))<9.9999E-05 OR NOT NU% AND NOT S%(0) THEN GOSUB 30000:PRINT " Excellent, ";N$;".":GOSUB 15000:GOSUB 30000:GOTO 26770
28100 GOSUB 30000:LOCATE 18,1:PRINT PR$;:GOSUB 18000:IF G$="" THEN 28100
28105 IF G$="0" AND COP$="Multiply" THEN GOSUB 30000:LOCATE 18:PRINT"Multiplying by zero will make each term":PRINT:PRINT"in the equation equal to zero.":E1%=E1%+1:GOSUB 15000:GOSUB 30000:RETURN
28110 GOSUB 30000:IF VA$<>"" AND NU% THEN PRINT " That's a mistake, "N$".":PRINT :PRINT COP$"ing by a term which has an":PRINT :PRINT VA$" in it will only make the equation":PRINT :PRINT "more complicated.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
28115 IF NU%=0 AND FN MD(2)=0.5 THEN LOCATE 18:PRINT " You can't do that, ";N$;".":PRINT :PRINT "Division by zero is not allowed.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
28120 IF NU%=DE% THEN LOCATE 18:PRINT " ";COP$;"ing both sides by one will":PRINT :PRINT "have no effect on the equation.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
28125 IF ABS(FN MD(NU%/DE%))>1 THEN LOCATE 18:PRINT " That won't help, ";N$;".":PRINT :PRINT COP$;"ing by the number you have":PRINT :PRINT "chosen will only make the coefficients":PRINT :PRINT "bigger.";:GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
28130 IF NOT ((IV%=-1 AND ABS(FN MD(DE%/NU%)-LSV%(0)/LSV%(1))>9.9999E-05) OR (IV%=1 AND ABS(FN MD(DE%/NU%)-RSV%(0)/RSV%(1))>9.9999E-05)) THEN 28200
28140 LOCATE 18:PRINT " That's not right, "N$".":PRINT :PRINT "To eliminate the coefficient of "SV$", you":PRINT :PRINT "should"OP$"by ";:VA$=""
28150 ON (2 * ABS(IV%=1)+ABS(FN MD(2)=0.5)) GOTO 28160,28170,28180
28200 ZZ=FN MD(NU%/DE%):IF IV% OR (FN WH(LX%(0)/LX%(1)*ZZ) AND FN WH(LY%(0)/LY%(1)*ZZ) AND FN WH(LC%(0)/LC%(1)*ZZ) AND FN WH(RX%(0)/RX%(1)*ZZ) AND FN WH(RY%(0)/RY%(1)*ZZ) AND FN WH(RC%(0)/RC%(1)*ZZ)) THEN 28500
28202 IF DE%=1 THEN XX%=NU%:GOTO 28210
28203 IF NU%>DE% THEN XX%=NU%/DE%:GOTO 28210
28204 XX%=DE%/NU%
28210 IF ABS(XX%)=ABS(B%) THEN 28220
28212 LOCATE 18:PRINT " I don't agree, ";N$;".":PRINT :PRINT "The number you have chosen would give":PRINT :PRINT "you fractions in the equation.":GOSUB 15000:GOSUB 30000:E1%=E1%+1:RETURN
28220 GOSUB 30000:LOCATE 18:PRINT" Although ";:IF COP$="Multiply" THEN PRINT"multiplication";:ELSE PRINT"division";
28225 PRINT" by ";:IF DE%=1 THEN IF NU%<0 THEN PRINT STR$(NU%):GOTO 28230:ELSE PRINT RIGHT$(STR$(NU%),LEN(STR$(NU%))-1):GOTO 28230
28227 FOR XX%=1 TO LEN(G$):IN$=MID$(G$,XX%,1):IF IN$="-" THEN PRINT"-";:ELSE PRINT CHR$(ASC(IN$)+137);
28228 NEXT:PRINT"/";:FOR XX%=1 TO LEN(D$):IN$=MID$(D$,XX%,1):IF IN$="0" THEN PRINT CHR$(137);:ELSE PRINT CHR$(ASC(IN$)+79);
28229 NEXT:PRINT
28230 PRINT:PRINT"is not incorrect, we prefer that you":PRINT:PRINT"isolate the y term first.";:GOSUB 15000:GOSUB 30000:RETURN
28691 XX%=INSTR(RE$,"/"):IF XX%=0 THEN 28698:ELSE PRINT:PRINT"Enter ";:IF (CO%(0)<0 AND CO%(1)>0) OR (CO%(0)>0 AND CO%(1)<0) THEN PRINT "-";
28692 PRINT RIGHT$(STR$(CO%(0)),LEN(STR$(CO%(0)))-1)"/"RIGHT$(STR$(CO%(1)),LEN(STR$(CO%(1)))-1)"x and I will insert the":PRINT:PRINT"parentheses for you, or enter ";
28693 IF CO%(0)=1 THEN PRINT"x";:ELSE IF CO%(0)=-1 THEN PRINT"-x";:ELSE IF CO%(0)<0 AND CO%(1)>0 THEN PRINT STR$(CO%(0))"x";:ELSE PRINT RIGHT$(STR$(CO%(0)),LEN(STR$(CO%(0)))-1)"x";
47450 ME$(0)="Very impressive!":ME$(1)="I see you've been doing your homework!":ME$(2)="Too bad your teacher can't see this!":ME$(3)="The math department is proud of you!":ME$(4)="Well, we can't all be perfect."
47460 ME$(5)="You almost made it on that one.":ME$(6)="That was a good try.":ME$(7)="Keep trying. You're doing well.":ME$(8)="Keep trying. You'll get it.":ME$(9)="You'll do better on the next one."
47470 ME$(10)="These problems are not so easy.":ME$(11)="Try again. Practice makes perfect."
51000 CLS:COLOR 0,1:XC=0:DEF SEG=0:POKE 1050,PEEK(1052):DEF SEG
51020 PRINT " Please type in your first name (up":PRINT :PRINT " to 10 letters) and press ENTER.":PRINT
51030 LOCATE 6,12:PRINT "Name: ";
51040 GOSUB 28900
51045 IF IN$=CHR$(13) AND LEN(N$)>0 THEN PRINT CHR$(29)" ";:GOTO 52000
51050 IF MID$(IN$,2,1)="K" THEN IN$=CHR$(8)
51060 IF IN$=CHR$(8) AND LEN(N$)> 1 THEN PRINT CHR$(29);" ";CHR$(29);:N$=LEFT$(N$,LEN(N$)-1):GOTO 51040
51070 IF IN$=CHR$(8) AND LEN(N$)=1 THEN PRINT CHR$(29);" ";CHR$(29);:N$="":GOTO 51040
51080 IF ASC(IN$)>96 THEN IN$=CHR$(ASC(IN$)-32)
51090 IF IN$<"A" OR IN$>"Z" THEN 51040
51100 IF LEN(N$)=0 THEN L=ASC(IN$):IF L>=97 THEN L=ASC(IN$)-32:IN$=CHR$(L)
51110 IF LEN(N$)>0 THEN L=ASC(IN$):IF L<=97 THEN L=ASC(IN$)+32:IN$=CHR$(L)
51120 IF LEN(N$)>=10 THEN 51040
51130 N$=N$+IN$:PRINT CHR$(29);IN$" ";:GOTO 51040
51990 ' *******************
51992 ' * Center screen *
51994 ' *******************
52000 RANDOMIZE -XC:IF KOLOR = TRUE THEN LOCATE 12,1:PRINT "<"STRING$(38,"-")">";" To center your screen, use the F9":PRINT :PRINT " and F10 keys.":GOSUB 15000
52010 RETURN
54000 ' *************************************
54010 ' * Adjust horizontal screen position *
54020 ' *************************************
55000 IF KOLOR=TRUE THEN IF INDENT<45 THEN INDENT=INDENT+1:OUT 980,2:OUT 981,INDENT
55010 RETURN
55020 IF KOLOR=TRUE THEN IF INDENT>40 THEN INDENT=INDENT-1:OUT 980,2:OUT 981,INDENT
55030 RETURN
55040 REM
55050 REM
55060 ' ***************************
55070 ' *** CHOOSE & SWITCH ***
55080 ' *** MONITORS ***
55090 ' ***************************
55100 TRUE=-1:FALSE=0
55110 '*** find out which adapters exist ***
55120 DEF SEG=&HB000
55130 POKE 0,32
55140 MONO=(PEEK(0)=32)
55150 POKE 0,0
55160 MONO=(PEEK(0)=0) AND MONO
55170 DEF SEG=&HB800
55180 POKE 0,32
55190 KOLOR=(PEEK(0)=32)
55200 POKE 0,0
55210 KOLOR=(PEEK(0)=0) AND KOLOR
55220 IF MONO AND KOLOR GOTO 55280
55230 IF KOLOR THEN GOSUB 55360:RETURN
55240 IF NOT MONO THEN 55250
55242 GOSUB 55410 ' switch to monochrome
55244 LOCATE 10,1:PRINT "Sorry, but you must have color graphics";:PRINT :PRINT " to run GRAPHING LINEAR FUNCTIONS "
55246 GOTO 55246
55250 '*** if we reach here there is a problem ***
55260 CLS:LOCATE 1,2,0:PRINT "SOMETHING WRONG -- NO ADAPTERS ..."
55270 GOTO 55270
55280 REM *** both adapters exist ***
55290 GOSUB 55410: LOCATE 10,3:PRINT "Please turn on your color monitor."
55300 GOSUB 55350 ' switch back to color
55340 RETURN
55350 '*** switch to color graphics adapter ***
55360 DEF SEG=&H40:I=PEEK(&H10):POKE &H10,(I AND &HCF) OR &H20