P705 CEEFAX 705 Thu 23 Jun 20:04/02  AREAS Age:8+ AREAS is designed to develop an ability to estimate the area of shapes. The user draws a shape on a grid and is then asked to estimate its area. This is then compared with the actual area, and an appropriate message is displayed The shape is drawn by moving a marker using the arrow keys, plotting the corners with the f0 key, and joining them up by pressing the f9 key. Full instructions and appropriate prompts are included in the program. Program follows
P705 CEEFAX 705 Thu 23 Jun 20:45/08 |B21117|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 1REM Written by L BROWN / N YEATES 2REM BBC / Brighton Polytechnic 3REM (C) Marc h 1983 4REM Requires BBC Model B Micro. 5IFPA. >&1900TH.142 6CL. 7*KEY10LOAD"AR EAS"|MRUN|M 8ONERR.G.6 9R$=CHR$&81:C$=CH R$&86:W$=CHR$&87:DH$=CHR$&8D:Y$=CHR$&83: Bd=CHR$&84:MO.7 10*FX225,240 11DIMX%(50) ,Y%(50) 12arr%=0:D=8:PROCtitle 13IFQ%=1T H.PROCrules 14MO.1:PROCgrid:V.5 15*FX 12 ,0 16X%=50:Y%=250 17PROCpch1(X%,Y%):PROC input:V.4 18PROCcalc 19CLS:C.2:P."Type i n your estimate of the area,":P.'"then p ress ";:C.1:P.bRETURN":C.2 20P.:PROCin0u t2:MO.7:PROCcomp 21PROCspace 22V.23;11,0 ;0;0;0 23IFM%<3TH.6 24CLS:END 25DEFPROCi nput 26REP. 27A%=INKEY(0) 28OX%=X%:OY%=Y % 29IFA%=240TH.PROCstore(X%,Y%) 30IFA%=2 49TH.PROCdraw 31IFA%=136A.X%>0+D TH.X%=X %-D 32IFAE=137A.X%<1200-D TH.X%=X%+D 33I FA%=138A.Y%>200+D TH.Y%=Y%-D 34IFA%=139A .Y%<1020-D TH.Y%=Y%+D |c0
P705 CEEFAX 705 Thu 23 Jun 20:45/25 |B21217|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 35PROCpch2(OX%,OY%):PROCpch1(X%,Y%) 36U. A%=249 37E. 38DEFPROCtitle 39F.b=0TO24:P .CHR$&84;CHR$&9D:N.b:TL$=C$+"AREAS" 40*F X4,1 41*FX11,0 42V.23;11,0;0;0;0 43P.TAB (15,2)DH$TL$TAB(15,3)DH$TL$:P.TAB(10,7)Y $+"A Telsoft Program" 44PROCbigst(C$+"1" +Y$+"Rules ",11,11,C$):PROCbigst("2"+Y$+ "Design a shape ",12,14,C$):PROCbigst(C$ +"3"+Y$+"End ",11,17,Y$):PROCbigst("Pres s"+C$+"1 2"+Y$+"or"+C$+"3 ",8,20,Y$):PRO Cone23 45E. 46DEFPROCone23 47*FX15,1 48M $=GE.:M%=VAL(M$) 49IFM%<1ORM%>3TH.48 50I FM%=1TH.Q%=1 EL.Q%=0 51IFM%=3TH.CLS:END 52E. 53DEFPROCbigst(AA$,XX%,YY%,CONTROL$ ) 54P.TAB(XX%+1,YY%)DH$CONTROL$AAd:P.TAB (XX%+1,YY%+1)DH$CONTROL$AA$ 55E. 56DEFPR OCprint(TEMP$,YY%,col$) 57LIN$="":SPACE% =39:F.LI%=1TOLEN(TEMP$):S$=M.TEMP$,LI%,1 ):S%=ASC(S$) 58IFS%<>32A.S%<129WORD$=WOR D$+S$:G.61 |c0
P705 CEEFAX 705 Thu 23 Jun 20:05/42 |B21317|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 59IFSPACE%<=LEN(WORD$)+1TH.PROCbigst(LIN $,2,YY%,col$):col$=COL$:SPACE%=39:LIN$=" "5YY%=YY%+3 60 LIN$=LIN$+WORD$++$:SPACE% =SPACE%-(LEN(WORD$)+1):WORD$=bb:IFS%=32C OL$=col$ EL.COL$=S$ 61N.:PROCbigst(LIN$, 2,YY%,col$):YY%=YY%W5 62E. 63DEFPROCrule s 64CLS:F.b=0TO24:P.CHR$&84;CHR$&9D:N.b 65PROCprint("You will be asked to draw a shape ",1,Y$):PROCprint("on a grid, and to estimate its ",4,Y$) 66PROCprint("ar ea. To plot a point move the * ",7,Y$):P ROCprint("to the correct place using the ",10,Y$):PROCprint("arrow keys, then pr ess the"+C$+bf0"+Y$+"key. ",13,Y$) 67PRO Cprint("To join up the points, press ",1 6,Y$):PROCprint("the"+C$+"f9"+Y$+"key. " ,19,Y$):PROCspace 68CLS:F.b=0TO24:P.CHR $&84;CHR$&9D:N.b |c0
P705 CEEFAX 705 Thu 23 Jun 20:05/58 |B21417|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 69PROCprint("The shape's lines mustn't " ,1,Y$):PROCprint("cross. When you have d rawn the ",4,Y$):PROCprint("shape, you w Ull be asked to ",7,Y$):PROCprint("estim ate its area. Type in your ",10,Y$) 70PR OCprint("estimate, then press "+C$+"RETU RN. ",13,Y$):PROCprint("The computer wil l tell you how ",16,Y$):PROCprint("accur ate your estimate was. ",19,Y$) 71PROCsp ace 72E. 73DEFPROCspace 74P.TAB(9,23)W$+ "Press SPACE bar "+Y$ 75*FX15,1 76REP. U.GET=32 77E. 78DEFPROCgrid 79V.28,0,31, R9)27 80P.5C.2:P."Press ";:C.%81:C.7:P." f0";:C.&805C.2:P." to plot a point." 81P .'"Press ";:C.%81:C.7:P."f9";:C.&80:C.2: P." to draw the shape" 82GC.0,1 83F.X%=0 TO1200S.100 84MOVEX%,200:PL.5,X%,1000 85 N. 86F.Y%=200TO1200S.100 87MOVE0,Y%:PL.5 ,1200,Y% 88N. 89GC.0,3 90E. 91DEFPROCpch 1(X%,Y%) 92GC.4,0 93MOVEX%,Y%:P."*" 94E. 95DEFPROCpch2(X%,Y%) 96GC.4,0 |c0
P705 CEEFAX 705 Thu 23 Jun 20:06/15 |B21517|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷ 97MOVEOX%,OY%:P."*" 98E. 99DEFPROCstore( X%,Y%) 100IFarr%>49TH.SO.1,-15,150,10:G. 103 101X%(arr%)=X%:Y%(arr%)=Y% 102arr%=a rr%+1:MOVEX%,Y%:P."+" 103E. 104DEFPROCdr aw 105GC.0,3:MOVEX%(0)+16,Y%(0)-16 106F. I%=1TOarr%-1 107DR.X%(I%)+16,Y%(I%)-16 1 08N. 109DR.X%(0)+16,Y%(0)-16 110E. 111DE FPROCcalc 112tot=0 113F.R%=0TOarr%-1 114 S%=R%+1-INT((R%+1)/arr%)*arr% 115T%=R%+2 -INT((R%+2)/arr%)*arr% 116tot=tot+X%(S%) *XY%(T%)-Y%XR%)) 117N. 118area=ABS(tot)/ 20000 119E. 120DEFPROCinput2 121REP. 122 A$=GE.:IFASC(A$)<>46A.(ASC(A$)<48ORASC(A $)>57)TH.124 123P.A$;:T$=T$+A$ 124U.ASC( A$)=13 125T$="+"+T$:est=VAL(T$) 126E. 12 7DEFPROCcomp 128V.23;11,0;0;0;0 129CLS:F .b=0TO24:P.CHR$&84;CHR$&9D:N.b |c0
P705 CEEFAX 705 Thu 23 Jun 10:46/45 |B21617|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 130PROCprint("Your estimate was "+C$+STR $Xest)+Y$+" ",1,Y$):area=(area*10):area% =area:area=(area%/10):PROCprint("The act ual area was "+C$+STR$(area)+Y$+" ",4,Y$ ):diff=ABS(area-est) 131IFdiff=0TH.PROCp rint("A superb estimate - well done! ",1 0,Y$):PROCprint("Now try a more difficul t shape. ",13,Y$):G.140 132diff%=area/di ff 133IFdiff%>=10TH.PROCprint("A superb estimate - well done! ",10,Y$):PROCprint ("Now try a more difficult shape. ",13,Y $):G.140 134 IFdiff%<3TH.PROCprint("Not a very good guess. ",10,Y$):PROCprint("T ry a less difficult shape. ",13,Y$):G.14 0 135diff%=diff%-2 136IFdiff%=1TH.PROCpr int("Not too bad. Try to be more ",10,Y$ ):PROCprint("accurate. ",13,Y$):G.140 13 7 IFdiff%=2TH.PROCprint("Not bad - a fai rly close ",10,Y$):PROCprint("estimate. ",13,Y$):G.140 |c0
P705 CEEFAX 705 Thu 23 Jun 20:06/10 |B21717|a35AREAS106030683|i24BBBC316k|p| s÷#1÷e|s÷Z0 138IFdiff%=3ORdiff%=4TH.PROCprint("Quite good - a close estimate. ",10,Y$):PROCp rint("Try to be more accurate. ",13,Y$): G.140 139PROCprint("A good estimate -try a slightly ",10,Y$):PROCprint("harder s hape. ",13,Y$) 140E. 141*TAPE 142F.I%=0T OTOP-PA. S.4:I%!&1900=I%!PA. :N. 143?&13 =?&13-(PA. -&1900)DIV256:PA. =&1900 144R UN |c0