From 410800127cf3a171797e6e6c8c0872503d68f53f Mon Sep 17 00:00:00 2001 From: em Date: Thu, 24 Jan 1985 11:27:36 +0000 Subject: [PATCH] *** empty log message *** --- lang/basic/test/Makefile | 10 ++ lang/basic/test/bull.b | 37 +++++++ lang/basic/test/buzzword.b | 66 +++++++++++++ lang/basic/test/checker.b | 192 +++++++++++++++++++++++++++++++++++++ lang/basic/test/creator.b | 30 ++++++ lang/basic/test/grafiek.b | 55 +++++++++++ lang/basic/test/gunner.b | 58 +++++++++++ lang/basic/test/learn.b | 25 +++++ lang/basic/test/opg1.b | 6 ++ lang/basic/test/opg2.b | 16 ++++ lang/basic/test/opg3.b | 12 +++ lang/basic/test/opg4.b | 10 ++ lang/basic/test/opg5.b | 13 +++ lang/basic/test/opg6.b | 14 +++ lang/basic/test/runcmp | 23 +++++ lang/basic/test/som4.b | 17 ++++ lang/basic/test/test01.b | 5 + lang/basic/test/test02.b | 2 + lang/basic/test/test03.b | 2 + lang/basic/test/test04.b | 5 + lang/basic/test/test05.b | 7 ++ lang/basic/test/test06.b | 5 + lang/basic/test/test07.b | 6 ++ lang/basic/test/test08.b | 8 ++ lang/basic/test/test09.b | 18 ++++ lang/basic/test/test10.b | 7 ++ lang/basic/test/test11.b | 4 + lang/basic/test/test12.b | 6 ++ lang/basic/test/test13.b | 7 ++ lang/basic/test/test14.b | 11 +++ lang/basic/test/test15.b | 6 ++ lang/basic/test/test16.b | 11 +++ lang/basic/test/test17.b | 3 + lang/basic/test/test18.b | 11 +++ lang/basic/test/test19.b | 15 +++ lang/basic/test/test20.b | 9 ++ lang/basic/test/test21.b | 10 ++ lang/basic/test/test22.b | 9 ++ lang/basic/test/test23.b | 11 +++ lang/basic/test/test24.b | 8 ++ lang/basic/test/test25.b | 7 ++ lang/basic/test/test26.b | 17 ++++ lang/basic/test/test27.b | 12 +++ lang/basic/test/test28.b | 7 ++ lang/basic/test/test29.b | 14 +++ lang/basic/test/test30.b | 8 ++ lang/basic/test/test31.b | 11 +++ lang/basic/test/test32.b | 5 + lang/basic/test/test33.b | 6 ++ lang/basic/test/test34.b | 4 + lang/basic/test/test35.b | 2 + 51 files changed, 863 insertions(+) create mode 100644 lang/basic/test/Makefile create mode 100644 lang/basic/test/bull.b create mode 100644 lang/basic/test/buzzword.b create mode 100644 lang/basic/test/checker.b create mode 100644 lang/basic/test/creator.b create mode 100644 lang/basic/test/grafiek.b create mode 100644 lang/basic/test/gunner.b create mode 100644 lang/basic/test/learn.b create mode 100644 lang/basic/test/opg1.b create mode 100644 lang/basic/test/opg2.b create mode 100644 lang/basic/test/opg3.b create mode 100644 lang/basic/test/opg4.b create mode 100644 lang/basic/test/opg5.b create mode 100644 lang/basic/test/opg6.b create mode 100755 lang/basic/test/runcmp create mode 100644 lang/basic/test/som4.b create mode 100644 lang/basic/test/test01.b create mode 100644 lang/basic/test/test02.b create mode 100644 lang/basic/test/test03.b create mode 100644 lang/basic/test/test04.b create mode 100644 lang/basic/test/test05.b create mode 100644 lang/basic/test/test06.b create mode 100644 lang/basic/test/test07.b create mode 100644 lang/basic/test/test08.b create mode 100644 lang/basic/test/test09.b create mode 100644 lang/basic/test/test10.b create mode 100644 lang/basic/test/test11.b create mode 100644 lang/basic/test/test12.b create mode 100644 lang/basic/test/test13.b create mode 100644 lang/basic/test/test14.b create mode 100644 lang/basic/test/test15.b create mode 100644 lang/basic/test/test16.b create mode 100644 lang/basic/test/test17.b create mode 100644 lang/basic/test/test18.b create mode 100644 lang/basic/test/test19.b create mode 100644 lang/basic/test/test20.b create mode 100644 lang/basic/test/test21.b create mode 100644 lang/basic/test/test22.b create mode 100644 lang/basic/test/test23.b create mode 100644 lang/basic/test/test24.b create mode 100644 lang/basic/test/test25.b create mode 100644 lang/basic/test/test26.b create mode 100644 lang/basic/test/test27.b create mode 100644 lang/basic/test/test28.b create mode 100644 lang/basic/test/test29.b create mode 100644 lang/basic/test/test30.b create mode 100644 lang/basic/test/test31.b create mode 100644 lang/basic/test/test32.b create mode 100644 lang/basic/test/test33.b create mode 100644 lang/basic/test/test34.b create mode 100644 lang/basic/test/test35.b diff --git a/lang/basic/test/Makefile b/lang/basic/test/Makefile new file mode 100644 index 000000000..0d3de7dd7 --- /dev/null +++ b/lang/basic/test/Makefile @@ -0,0 +1,10 @@ +SRC= bull.b buzzword.b checker.b creator.b grafiek.b gunner.b learn.b\ + opg1.b opg2.b opg3.b opg4.b opg5.b opg6.b som4.b test01.b test02.b\ + test03.b test04.b test05.b test06.b test07.b test08.b test09.b\ + test10.b test11.b test12.b test13.b test14.b test15.b test16.b\ + test17.b test18.b test19.b test20.b test21.b test22.b test23.b\ + test24.b test25.b test26.b test27.b test28.b test29.b test30.b\ + test31.b test32.b test33.b test34.b test35.b + +head: + for i in $(SRC) ; do runcmp $$i ; done diff --git a/lang/basic/test/bull.b b/lang/basic/test/bull.b new file mode 100644 index 000000000..0fceb93e5 --- /dev/null +++ b/lang/basic/test/bull.b @@ -0,0 +1,37 @@ +10 rem *** bullseye +20 print "game of bullseye":print:randomize +30 print "in this game, up to 20 players throw darts at a target" +40 print "with 10,20,30, and 40 point zones. The objective is" +50 print "toget 200 point.":print +60 print "throw","description",,"probable score" +70 print " 1","fast overarm",,"bullseye or complete miss" +80 print " 2","controlled overarm","10,20,30 points" +90 print " 3","underarm",,"anything":print +100 dim a$(20),s(20),w(10):r=0:m=0: for i=1 to 20:s(i)=0:nexti +110 input ;"how many players";n:print +120 for i=1 to n +130 print "name of player" i; : input a$(i) +140 nexti +150 r=r+1:print:print "round" r +160 for i=1 to n +170 print:print a$(i)"'s throw";:input t +180if t<1 or t>3 then print "input 1, 2, or 3":goto 170 +190 on t goto 200,210,220 +200 p1=.65:p2=.55:p3=.5:p4=.5:goto 230 +210p1=.99:p2=.77:p3=.43:p4=.01:goto 230 +220 p1=.95:p2=.75:p3=.45:p4=.05 +230 u=rnd(0):print "rnd="u +240 if u>=p1 then print "BULLSEYE!! 40 points":b=40:goto 290 +250 if u>=p2 then print "30-point zone":b=30:goto 290 +260 if u>=p3 then print "20-point zone":b=20:goto 290 +270 if u>=p4 then print "WHEH! 10 points":b=10:goto 290 +280 print "missed the target. too bad!":b=0 +290 s(i)=s(i)+b:print "total score="s(i):next i +300 fori=1 to n +310 if s(i)>=200 then m=m+1:w(m)=i +320 nexti +330 if m=0 then150 +340 print :print "We have a winner!!":print +350 print a$(w(m))" scored"s(w(m))"points." +360 for i=1 to m +370 print:print "thanks for the game!":nexti:end diff --git a/lang/basic/test/buzzword.b b/lang/basic/test/buzzword.b new file mode 100644 index 000000000..c1de180ab --- /dev/null +++ b/lang/basic/test/buzzword.b @@ -0,0 +1,66 @@ +100 print "This computer program demonstration us a new aid for" +110 print "preparing speeches and briefings. It's a buzzword" +120 print "generator which provides you with a set of three higly" +130 print "acceptablewords to work into your material. The words" +140 print "don't actually mean anything, but they sound great." +150 print +160 print "the procedure:" +170 print ,"Think of any three numbers between 0 and 9, enter" +180 print , "them after the '?' separated by commas. your" +190 print ,"buzzword will be printed out. Typing "100" for" +200 print ,"each of your choices stops this program." +210 print "What are your three numbers"; +220 goto 260 +230 print +240 print +250 print "Three more numbers"; +260 input n,m,p +265 if n= 100 then 1290 +267 print "continue" +270 if n<0 then 1240 +280 if p<0 then 1240 +290 if m<0 then 1240 +300 if m>9 then 1240 +310 if p>9 then 1240 +320 if n>9 then 1240 +330 print +340 on n+1 goto 640,660,680,700,720,740,760,780,800,820 +440 on m+1 goto 840,860,880,900,920,940,960,980,1000,1020 +540 on p+1 goto 1040,1060,1080,1100,1120,1140,1160,1180,1200,1220 +640 print " integrated";: goto 440 +660 print " total";: goto 440 +680 print " systematized";: goto 440 +700 print " parallel";: goto 440 +720 print " functional";: goto 440 +740 print " responsive";: goto 440 +760 print " optimal";: goto 440 +780 print " synchronized";: goto 440 +800 print " compatible";: goto 440 +820 print " balanced";: goto 440 +840 print " management"; : goto 540 +860 print " organizational"; : goto 540 +880 print " monitored"; : goto 540 +900 print " reciprocal"; : goto 540 +920 print " digital"; : goto 540 +940 print " logistical"; : goto 540 +960 print " transitional"; : goto 540 +980 print " incremental"; : goto 540 +1000 print " fifth-generation"; : goto 540 +1020 print " policy"; : goto 540 +1040 print " options";: goto 230 +1060 print " flexibility";: goto 230 +1080 print " capability";: goto 230 +1100 print " mobility";: goto 230 +1120 print " programming";: goto 230 +1140 print " concept";: goto 230 +1160 print " time-phase";: goto 230 +1180 print " projection";: goto 230 +1200 print " hardware";: goto 230 +1220 print " contingency";: goto 230 +1240 print +1260 print +1270 print "numbers must be between 0 and 9, please select three more." +1280 goto 260 +1290 print "Goodbye for now." +1300 print:print:print +1310 end diff --git a/lang/basic/test/checker.b b/lang/basic/test/checker.b new file mode 100644 index 000000000..09751e559 --- /dev/null +++ b/lang/basic/test/checker.b @@ -0,0 +1,192 @@ +100 print "This program will play checkers. The computer us X," +110 print "and you are 0. The computer will go first, -note: squares" +120 print "are printed in the form-(X,Y) and sq. 1.1 is the bottom left!" +130 print "do not attempt a double jump or your piece might just" +140 print "disappear (same for triple!)" +150 print " Wait for the computer to move!!!!!!" +700 g=-1 +800 dim r(50) +900 let l=-1 +1000 dim s(10,10) +1100 data 1,0,1,0,0,0,-1,0,0,1,0,0,0,-1,0,-1,15 +1200 for x=1to8 +1300 fory=1to8 +1400 read j +1500 if j=15 then 1800 +1600 s(x,y)=j +1700 goto 2000 +1800 restore +1900 reads(x,y) +2000 nexty +2100 nextx +2200 rem +2300 l=-1*l +2400 for x=1to 8 +2500 for y=-1to8 +2600 if s(x,y)=0 then 3500 +2700 if g>0 then 3000 +2800 if s(x,y)>0 then 3500 +2900 goto 3100 +3000 if s(x,y)<0 then 3500 +3100 if abs(s(x,y))<>1 then 3300 +3200 gosub 4300 +3300 if abs(s(x,y))<>2 then 3500 +3400 gosub 6500 +3500 if x<>8 then 3800 +3600 if l=1 then 3800 +3700 rem return +3800 nexty +3900 nextx +4000 print +4100 gosub 11400 +4200 goto 2300 +4300 for a=-1 to 1 step2 +4400 let u=x+a +4500 let v=y+g +4600 if u<1 then 6300 +4700 if u>8 then 6300 +4800 if v<1 then 6300 +4900 if v>8 then 6300 +5000 if s(u,v) <> 0 then 5300 +5100 gosub 9100 +5200 goto 6300 +5300 if s(u,v)=g then 6300 +5400 if s(u,v)=2*g then 6300 +5500 u=u+a +5600 v=v+g + +5700 if u<1 then 6300 +5800 if u>8 then 6300 +5900 if v<1 then 6300 +6000 if v>8 then 6300 +6100 if s(u,v)<>0 then 6300 +6200 gosub 9100 +6300 next a +6400 return +6500 rem king moves +6600 for a=-1 to 1 step2 +6700 forb=-1to 1step2 +6800 u=x+a +6900 v=y+b +7000 if u<1 then 8700 +7100 if u>8 then 8700 +7200 if v<1 then 8700 +7300 if v.8 then 8700 +7400 if s(u,v)<>0 then 7700 +7500 gosub 9100 +7600 goto 8700 +7700 if s(umv)=g then 8700 +7800 if s(u,v)=2*g then 8700 +7900 u=u+a +8000 v=v+b +8100 if u<1 then 8700 +8200 if u>8 then 8700 +8300 if v<1 then 8700 +8400 if v>8 then 8700 +8500 if s(u,v)<>0 then 8700 +8600 gosub 9100 +8700 next b +8800 next a +8900return +9000 goto 14200 +9100 rem +9200 p=p+1 +9300 if p=k then 12300 +9400 if v<>(4.5+(3.5*g)) then 9600 +9500 q=q+2 +9600 if x<>(4.5-(3.5*g)) then9800 +9700 q=q-2 +9800 rem +9900 if u<>1 then 10100 +10000 q=q+1 +10100 if u<> 8 then 10300 +10200 q=q+1 +10300 for c=-1 to 1 step 2 +10400 if s(u+c,v+g)<1 then 10800 +10500 q=q-1 +10600 if s(u-c,v-g) <> 0 then 10800 +10700 q=q-1 +10800 rem this was the evaluation section +10900 rem +11000 next c +11100 r(p)=q +11200 q=0 +11300 return +11400 if p=0 then 18800 +11500 for j=10to-10step -1 +11600for f=1to p +11700 if r(f)=j then 12000 +11800 next f +11900 next j +12000 let k=f+p +12100 print "retry": gosub 2300 +12200 return +12300 print " I move from ("X Y") to("U;V")" +12400 letf=0 +12500 p=0 +12600 k=0 +12700 if v<>(4.5+(3.5*g)) then 13000 +12800 s(u,v)=s*g +12900 goto 13100 +13000 let s(u,v)=s(x,y) +13100 let s(x,y)=0 +13200 if(abs(x-u))<>2 then 13400 +13300 s((x+u)/2,(y+v)/2)=0 +13400 print "board"; +13500 input d$ +13600 if d$<>"yes" then 13900 +13700 gosub 14100 +13800 return +13900 gosub 15800 +14000 return +14100 print +14200 for y=8to1step -1 +14300 for x=1to8 +14400 i=2*x +14500 if s(x,y)<>0 then14700 +14600 print tab(i)"."; +14700 if s(x,y)<>1 then 14900 +14800 print tab(i)"0" +14900 if s(x,y)<>-1then 15100 +15000 print tab(i)"X" +15100 if s(x,y)<>-2 then 15300 +15200 print tab(i)"X";tab(I)"*" +15300 if s(x,y)<>2 then 15500 +15400 print tab(i)"O";tab(I)"*" +15500 next x +15600 print +15700 next y +15800 print +15900 print "from"; +16000 input e,h +16100 x=e +16200 y=h +16300 if s(x,y)<>0 then 16700 +16400 print "there is no one occupying that space" +16500 print +16600 goto 15900 +16700 print "to"; +16800 input a,b +16900 x=a +17000 y=b +17100 if s(x,y)=0 then 17500 +17200 print "that space is already occupied" +17300 print +17500 rem +17400 goto 16700 +17600 s(a,b)=s(e.h) +17700 s(e,h)=0 +17800 t=(4.5-(3.5*g)) +17900 if abs(e-a)<>2 then 18100 +18000 s((e+a)/2,(h+b)/2)=0 +18100 if b<>t then 18300 +18200 s(a,b)= -2*g +18300 for x=8to8 +18400 for y=8to8 +18500 return +18600 nexty +18700 next x +18800 print " very good, you win" +18900 print:print +19100 print " chuck out" +19200 end diff --git a/lang/basic/test/creator.b b/lang/basic/test/creator.b new file mode 100644 index 000000000..90267cb4a --- /dev/null +++ b/lang/basic/test/creator.b @@ -0,0 +1,30 @@ + 10 rem The Creator + 20 rem 80 micro jan 1983 + 70 clear 3000 + 80 print"This is the Creator. It will allow you to generate" + 90 print"a progam which will create and access a data file." + 100 print"For later use. Please type the proposed program name." + 110 print"You are limited to 8 alphabetic characters." + 120 print" program name=";:lineinputpn$ + 130 fori=1tolen(pn$):a$=mid$(pn$,i,1):ifa$>"z"ora$<"A"thenprint"alpha characters only!":goto 120 + 140 nexti + 150 iflen(pn$)>8thenprint"too long":goto 120 + 160 print"when the proposed program is run, which drive contains the" + 170 print"data file(0-3)?"; + 180 an$=inkey$:ifan$="" then 180 elseif(an$>"3"oran$<"0")then170 + 190 printan$ + 200 print"which drive do you want the program written on? (0-3)"; + 210 dn$=inkey$:ifdn$="" then 210 elseif(dn$>"3"ordn$<"0")then200 + + 240 print#1," 1 rem*******Program name:";pn$;"*******" + 250 print#1," 2 rem*******Data File name:";df$;"*****" + 260 print#1," 3 rem*******Data File is on drive";ans$;"******" + 270 input"What is the maximum data file size, in # of records";ms + 280 input"What is the record length(1-255)";rr:ifrr<0orrr>255then280 else r%=256/rr + 290 ifms*256/r%>85760thenprint"not enough room on a single disk for this.":goto 270 + 300 print#1,"4 rem ******maximum file size is";ms;"records******" + 310 print#1,"5 rem****** record length is";rr;"packed";r%;"per sector" + 320 q$=chr$(34) + 330 print"please type in a title for your generated program.":lineinputti$ + 340 ln=ln+10:print#1,ln;"rem change disks reinitialize here" + 350 ln=ln+10 diff --git a/lang/basic/test/grafiek.b b/lang/basic/test/grafiek.b new file mode 100644 index 000000000..3decbf669 --- /dev/null +++ b/lang/basic/test/grafiek.b @@ -0,0 +1,55 @@ +0015 print +0020 for f =2 to 72 step 2 +0030 print tab (f) "-" ; +0040 next f +0043 print +0045 c= 30 +0050 for x=6 to 360 step 12 +0060 a=30 +25*sin(x*0.01745329) +0070 b=30+25*cos(x*0.01745329) +0080 if a=c then 0130 +0090 if b=c then 0190 +0100 if a=b then 0230 +0110 if a>c then 0290 +0120 if c>a then 0380 +0130 if a>b then 0360 +0140 ifb>a then 0170 +0150 print tab(b) "." tab(a) "*" +0160 goto 0460 +0170 print tab(a) "*" tab(b) "." +0180 goto 0460 +0190 if a>b then 0210 +0200 if b>a then 0220 +0210 goto 0150 +0220 goto 0170 +0230 if a>c then 0250 +0240 if c>a then 0270 +0250 print tab(c) "I" tab(a) "*" +0260 goto 0460 +0270 print tab(a) "*" tab(c) "I" +0280 goto 0460 +0290 if b>a then 0340 +0300 if a>b then 0302 +0302 if c>b then 0320 +0305 if bc then 0360 +0320 print tab(b) "." tab(c) "I" tab(a) "*" +0330 goto 0460 +0340 print tab(c) "I" tab(a) "*" tab(b) "." +0350 goto 0460 +0360 print tab(c) "I" tab(b) "." tab(a) "*" +0370 goto 0460 +0380 if a>b then 0430 +0385 if c>b then 0410 +0387 if b>c then 0450 +0395 if a>b then 0410 +0400 if b>a then 0450 +0410 print tab(a) "*" tab(b) "." tab(c) "I" +0420 goto 0460 +0430 print tab(b) "." tab(a) "*" tab(c) "I" +0440 goto 0460 +0450 print tab(a) "*" tab(c) "I" tab(b) "." +0460 next x +0470 end + + diff --git a/lang/basic/test/gunner.b b/lang/basic/test/gunner.b new file mode 100644 index 000000000..ef76fd3d9 --- /dev/null +++ b/lang/basic/test/gunner.b @@ -0,0 +1,58 @@ +10 rem gunner program +90 randomize +100 print "this program simulates the results " +110 print "of firing a field artillery weapon" +120 print +130 print "you are the officer-in-charge, giving orders to the gun" +140 print "crew, telling them the degrees of elevation you estimate" +150 print "will place the projectile on target. A hit within 100 yards" +160 print "of the target will destroy it. Take more than 5 shots," +170 print "end the enemy will destroy you!":print +180 print "maximum range of your gun is 46500 yards." +185 z=0 +190 print +195 s1=0 +200 t= 43000-30000*rnd(x) +210 s=0 +220 goto 370 +230 print"minimum elevation of the gun is one degree." +240 goto 390 +250 print "maximum elevation of gun is 89 degrees." +260 goto 390 +270 print "over target by";abs(e);"yards" +280 goto 390 +290 print "short of target by";abs(e);"yards" +300 goto 390 +310 goto 320 +320 print "*****target destroyed ****";s;"rounds of ammunition expended" +322 gosub 600 +325 s1=s1+s +330 if z=4 then 490 +340 z=z+1 +345 print +350 print "the forward observer has sighted more enemy activity." +360 goto 200 +370 print " distance to the target is";int(t);"yards...." +380 print +390 print +400 print "elevation"; +410 input b +420 if b>89 then 250 +430 if b<1 then 230 +440 s=s+1 +442 if s<6 then 450 +444 print:print "BOOM !!! You have been destroyed"; +445 gosub 600 +446 print "by the enemy":print:print:goto 495 +450 b2=2*b/57.3:let i=46500*sin(b2):x=t-i:e=int(x) +460 if abs(e)<100 then 310 +470 if e>100 then 290 +480 if e<-100 then 270 +490 print:print:print "total rounds expended were";s1 +491 if s1>15 then 495:print "nice shooting!!":gosub 600:goto 500 +495 print "better go back to fort silly for refresher training!" +500 print:print "thank you for playing!" +505 print:print "try again....":print:goto 180 +600 rem for n=1 to 10 print chr$(7): rem next n +610 return +999 end diff --git a/lang/basic/test/learn.b b/lang/basic/test/learn.b new file mode 100644 index 000000000..6fb7439c6 --- /dev/null +++ b/lang/basic/test/learn.b @@ -0,0 +1,25 @@ +10 REM Learning program I +15 dim variable(10), rank(10), varname$(10) +20 input "how many variable have you";v +30 for i=1to v :variable(i)=0:rank(i)=0:next i +40 print "please name these variable" +50 for i=1to v: input "variable name";varname$(i):next i +60 print "Please name the outcomes" +70 input "outcome 1";q1$ +80 input "outcome 2"; q2$ +90 for i=1 to v:variable(i)=0 +100 print "variable ";varname(i); +110 input "is this variable the case";a$ +120 if a$="y" then variable(i)=1 +130 next i +140 d=0 +150 for i=1 to v +160 d=d+variable(i)* rank(i) +170 next i +175 print "conclusion: ";d; +180 if d>=0 then print q1$ +190 if d<0 then print q2$ +195 input "is this right";a$:if a$="y" then:goto 90 +200 if d>=0 and a$="n" then: for i=1 to v:rank(i)=rank(i)-variable(i):next i +210 if d<0 and a$="n" then: for i=1 to v:rank(i)=rank(i)+variable(i):next i +220 goto 90 diff --git a/lang/basic/test/opg1.b b/lang/basic/test/opg1.b new file mode 100644 index 000000000..54cb694ef --- /dev/null +++ b/lang/basic/test/opg1.b @@ -0,0 +1,6 @@ +100 rem interest rate program page 33 +110 read m,d,p,n +300 let r= m * d /(p*(n+1)) * 200 +400 print "percent interest is",r +500 data 12, 320, 3000, 36 +600 end diff --git a/lang/basic/test/opg2.b b/lang/basic/test/opg2.b new file mode 100644 index 000000000..5ed64c80b --- /dev/null +++ b/lang/basic/test/opg2.b @@ -0,0 +1,16 @@ +100 rem Square root program (47) +110 rem this program uses the newton raphson +120 rem technique to calculate the square root +130 read a,e +140 let x =(a+2)/3 +150 let x1= (x+a/x)*.5 +160 rem determine absolute value of x1-x +170 let n= x1-x +180 if n>= 0 then 200 +19 let n= 0-n +200 if n= 20 then 120 +100 let n= n+1 +110 goto 40 +120 end diff --git a/lang/basic/test/opg4.b b/lang/basic/test/opg4.b new file mode 100644 index 000000000..55a0548ba --- /dev/null +++ b/lang/basic/test/opg4.b @@ -0,0 +1,10 @@ +010 rem values of n using for loop (52) +020 print "n","n2","n3","1/n","square root" +030 for n=1 to 20 +040 let n2= n*n +050 let n3= n*n*n +060 let r= 1/n +070 let s= n^ .5 +080 print n,n2,n3,r,s +090 next n +120 end diff --git a/lang/basic/test/opg5.b b/lang/basic/test/opg5.b new file mode 100644 index 000000000..83d127fa2 --- /dev/null +++ b/lang/basic/test/opg5.b @@ -0,0 +1,13 @@ + + 10 rem find largest number (57) + 20 read l + 30 let r=0 + 40 for z=1 to l + 50 read a + 60 if a<=r then 80 + 70 let r=a + 80 next z + 90 print "largest number is",r +100 data 10 +110 data 106, 42,-12,111,88,91,3,263,-1042,7 +120 end diff --git a/lang/basic/test/opg6.b b/lang/basic/test/opg6.b new file mode 100644 index 000000000..2ce12915b --- /dev/null +++ b/lang/basic/test/opg6.b @@ -0,0 +1,14 @@ +1000 rem Temperature conversion +1010 print "fahrenheit","centrigrade","kelvin","rankin" +1020 for s= 1 to 5 +1030 print +1040 next s +1050 for i= 1 to 12 +1060 read f +1070 let c= 5/9 *(f-32) +1080 let k = c+273 +1090 let r= f+ 460 +1100 print f,c,k,r +1110 next i +1120 data 144, 36,110,98,63,26,14,78,66,51,107,2 +1130 end diff --git a/lang/basic/test/runcmp b/lang/basic/test/runcmp new file mode 100755 index 000000000..358ba002b --- /dev/null +++ b/lang/basic/test/runcmp @@ -0,0 +1,23 @@ +echo -n $1 " " +if abc - -o $1.x $1 +then + if $1.x >$1.r + then :; else + echo -n "------- execution error(s)" + fi + if diff $1.g $1.r >$1.d 2>/dev/null + then + echo -*- Ok + else + if test -r $1.g + then + echo ------- differences in executing $1 + cat $1.d + else + mv $1.r $1.g + fi + fi + rm $1.[rd] +else + echo "------- compilation error(s)" +fi diff --git a/lang/basic/test/som4.b b/lang/basic/test/som4.b new file mode 100644 index 000000000..3747cfb90 --- /dev/null +++ b/lang/basic/test/som4.b @@ -0,0 +1,17 @@ +0010 print " beginwaarde =a" +0020 input a +0030 print "eindwaarde =b" +0040 input b +0050 if b0 then print "ok2" elseprint "error2" +120 if 1<2 then print "1<2" else print "error 1<2" +130 if 1<0 then print "error 1<0" else print "1<0 " +220 if 1<=2 then print "1<=2" else print "error 1<=2" +230 if 1<=0 then print "error 1<=0" else print "1<=0 " +320 if 1>2 then print "error 1>2" else print "1>2" +330 if 1>0 then print "1>0" else print "error 1>0 " +420 if 1>=2 then print "error 1>=2" else print "1>=2" +430 if 1>=0 then print "1>=0" else print "error 1>=0 " +500 if -1 and -1 then print "-1 and -1" else print "error -1 and -1" +510 if -1 and 0 then print "error -1 and 0" else print "-1 and 0" +520 if -1 or -1 then print "-1 or -1" else print "error -1 and -1" +530 if -1 or 0 then print "-1 or 0" else print"error -1 or 0" +540 if 0 or 0 then print "error 0 or 0" else print "0 or 0" +600 if 1<1 then print "error 1<1" else print "1<1" +605 i=100 +610 if i=100 then print "i=100" else print "error i=100" diff --git a/lang/basic/test/test10.b b/lang/basic/test/test10.b new file mode 100644 index 000000000..6edc85434 --- /dev/null +++ b/lang/basic/test/test10.b @@ -0,0 +1,7 @@ +100 rem compound goto +110 leti=1:print i +120 on i goto 130, 140, 150 +121 printi"end":stop +130 print "line130":i=i+1:goto120 +140 print "line140":i=i+1:goto120 +150 print "line150":i=i+1:goto120 diff --git a/lang/basic/test/test11.b b/lang/basic/test/test11.b new file mode 100644 index 000000000..2ba31afc4 --- /dev/null +++ b/lang/basic/test/test11.b @@ -0,0 +1,4 @@ +100 rem the first forloop +110 for i=1 to 4 step2 +120 print i +130 nexti diff --git a/lang/basic/test/test12.b b/lang/basic/test/test12.b new file mode 100644 index 000000000..c65963404 --- /dev/null +++ b/lang/basic/test/test12.b @@ -0,0 +1,6 @@ +100 gosub 200 +110 print "succeeded" +120 stop + +200 print "subroutine" +210 return diff --git a/lang/basic/test/test13.b b/lang/basic/test/test13.b new file mode 100644 index 000000000..eee146364 --- /dev/null +++ b/lang/basic/test/test13.b @@ -0,0 +1,7 @@ +100 rem compound goto +110 leti=1:print i +120 on i gosub 130, 140, 150 +121 printi"end":stop +130 print "line130":i=i+1:return +140 print "line140":i=i+1:return +150 print "line150":i=i+1:return diff --git a/lang/basic/test/test14.b b/lang/basic/test/test14.b new file mode 100644 index 000000000..487e00f9e --- /dev/null +++ b/lang/basic/test/test14.b @@ -0,0 +1,11 @@ +100 dim a(13) +101 print "help",a(1) +102 a(1)=3: print "ok" +103 print a(1) +107 for i=0 to 13 +108 a(i)=i*i +109 nexti +112 for i=0 to 13 +113 print i, a(i) +114 nexti +115 a(-4)= 3 diff --git a/lang/basic/test/test15.b b/lang/basic/test/test15.b new file mode 100644 index 000000000..2e262d049 --- /dev/null +++ b/lang/basic/test/test15.b @@ -0,0 +1,6 @@ +100 rem non-declared array test +110 s$(1)= "menu" +120 s(2)= "enter date" +130 print s(1) +140 print s(2) +150 print s(3) diff --git a/lang/basic/test/test16.b b/lang/basic/test/test16.b new file mode 100644 index 000000000..1f155acfd --- /dev/null +++ b/lang/basic/test/test16.b @@ -0,0 +1,11 @@ +100 rem two dimensional array +110 dim table(3,3) +120 for i=0 to 3 +130 for j=0 to 3 +135 print i,j +140 table(i,j)= i*j +150 next j,i +160 print "filled" +170 for i=0 to 3 +180 print table(i,i) +190 nexti diff --git a/lang/basic/test/test17.b b/lang/basic/test/test17.b new file mode 100644 index 000000000..faae13095 --- /dev/null +++ b/lang/basic/test/test17.b @@ -0,0 +1,3 @@ +100 rem first trap handling test +110 print 1/0 +120 print "divide error not catched" diff --git a/lang/basic/test/test18.b b/lang/basic/test/test18.b new file mode 100644 index 000000000..e820e452d --- /dev/null +++ b/lang/basic/test/test18.b @@ -0,0 +1,11 @@ +110 rem second trap test +120 on error goto 200 +130 print 1/o +140 print "division error not catched" +200 print "division error catched", err, erl +210 on error goto 500 +220 print "waiting for interrupt" +230 goto 230 +500 print "interrupt catched" +510 print "generate error 352" +520 error 352 diff --git a/lang/basic/test/test19.b b/lang/basic/test/test19.b new file mode 100644 index 000000000..8e1e4f93f --- /dev/null +++ b/lang/basic/test/test19.b @@ -0,0 +1,15 @@ +100 read a +110 print a +120 restore +130 read b +140 print b +142 restore +143 restore 170 +144 read b,c +145 print b,c +146 print "try to read beyond eof" +147 read d +148 print d +150 data 6 +170 data 8,9 +180 end diff --git a/lang/basic/test/test20.b b/lang/basic/test/test20.b new file mode 100644 index 000000000..f09f9e4ff --- /dev/null +++ b/lang/basic/test/test20.b @@ -0,0 +1,9 @@ +100 read a +110 read b +120 read c,d, e +130 let x=a+b+c+d +140 print a,b,c,d,e,x +150 data 6 +160 data 7,3 +170 data 142, 0 +180 end diff --git a/lang/basic/test/test21.b b/lang/basic/test/test21.b new file mode 100644 index 000000000..d8d24d433 --- /dev/null +++ b/lang/basic/test/test21.b @@ -0,0 +1,10 @@ +80 open "i",#3,"tst/data" +100 input #3, a +105 print a +110 input #3, b +115 print b +120 input #3, c,d +125 print c,d +130 let x=a+b+c+d +140 print a,b,c,d,x +180 end diff --git a/lang/basic/test/test22.b b/lang/basic/test/test22.b new file mode 100644 index 000000000..c69d7e35f --- /dev/null +++ b/lang/basic/test/test22.b @@ -0,0 +1,9 @@ +10 open "i", #6, "tst/data1" +20 input #6, s$ +30 print s$ +40 input #6, s1$ +50 print s1$ +60 print "try to read beyond" +70 input #6, s$ +80 print s$ +90 end diff --git a/lang/basic/test/test23.b b/lang/basic/test/test23.b new file mode 100644 index 000000000..55f5d52fa --- /dev/null +++ b/lang/basic/test/test23.b @@ -0,0 +1,11 @@ +100 print "testing input from terminal" +130 input "integer"; a +140 print a +220 input "float:", a +240 print a +330 input b$ +340 print b$ +350 input ; "c and d "; c,d +360 print c,d +400 end + diff --git a/lang/basic/test/test24.b b/lang/basic/test/test24.b new file mode 100644 index 000000000..53434c9ec --- /dev/null +++ b/lang/basic/test/test24.b @@ -0,0 +1,8 @@ +100 rem float arithmetic +110 print "1.0+3.14=" 1.0+3.14 +115 a= 1.0+3.14: print a +120 print "3.19*23.6=", 3.19*23.6 +125 b= 3.19*23.6: print b +220 print "3.19*(23.6+23)=", 3.19*(23.6+23) +225 b= 3.19*(23.6+23): print b +230 end diff --git a/lang/basic/test/test25.b b/lang/basic/test/test25.b new file mode 100644 index 000000000..143887b4d --- /dev/null +++ b/lang/basic/test/test25.b @@ -0,0 +1,7 @@ +100 rem declare parameterless functions +120 def fnpi= 3.14 +130 print fnpi, fnpi+2 +140 def fnsqr(x)= x*x +150 print fnsqr(2.0) +240 def fnpow(x,k)= x-k +250 print fnpow(2.0,3.0) diff --git a/lang/basic/test/test26.b b/lang/basic/test/test26.b new file mode 100644 index 000000000..17eafb658 --- /dev/null +++ b/lang/basic/test/test26.b @@ -0,0 +1,17 @@ +70 print "cint" cint(45.67), cint(-45.67) +80 print "fix" fix(58.75), fix(-58.75) +90 print "int" int(99.98), int(-12.11) +100 print "abs" abs(-1), abs(-3.14), abs(1), abs(1.0), abs(-0) +110 print "sgn" sgn(-1), sgn(-3.14), sgn(1), sgn(1.0), sgn(-0) +120 print "asc" asc("a"), asc("0") +130 print "atn" atn(0), atn(3.14/2), atn(3.14), atn(0.5) +140 print "chr" chr$(97), chr$(48) +150 print "cos" cos(0), cos(3.14/2), cos(3.14), cos(-1) +160 print "sin" sin(0), sin(3.14/2), sin(3.14), sin(-1) +170 print "exp" exp(0), exp(3.14/2), exp(3.14), exp(-1) +180 print "hex" hex(0), hex(16), hex(-1) +190 print "oct" oct(0), oct(16), oct(-1) +200 print "len" len(""), len("abc"), len("a") +270 print "tan" tan(0), tan(3.14/2), tan(3.14), tan(-1) +280 print "sqr" sqr(0), sqr(3.14/2), sqr(3.14) +290 print "log" log(3.14/2), log(3.14) diff --git a/lang/basic/test/test27.b b/lang/basic/test/test27.b new file mode 100644 index 000000000..6927c995b --- /dev/null +++ b/lang/basic/test/test27.b @@ -0,0 +1,12 @@ +0 rem string test +110 yes$= "yes" +120 no$="no" +130 if "yes"="no" then print "130 true" else print "130 f" +140 if "yes"="yes" then print "140 true" else print "140 f" +150 if "yes"="" then print "150 true" else print "150 f" +160 if "yes"=yes then print "160 true" else print "160 f" +170 if yes="yes" then print "170 true" else print "170 f" +180 print "yes or no" +190 input answer$ +200 print answer$="yes" +210 print answer$=no diff --git a/lang/basic/test/test28.b b/lang/basic/test/test28.b new file mode 100644 index 000000000..280be4b1a --- /dev/null +++ b/lang/basic/test/test28.b @@ -0,0 +1,7 @@ +10 rem reading beyond eof +11 open "r",#1,"tst/test01" +13 print eof(#1) +20 while eof(#1) <> -1 +22 line #1, l$ +23 print eof(#1), l +24 wend diff --git a/lang/basic/test/test29.b b/lang/basic/test/test29.b new file mode 100644 index 000000000..4eb2b19f6 --- /dev/null +++ b/lang/basic/test/test29.b @@ -0,0 +1,14 @@ +5 print not 1, not 0 +10 print 1 and 1, 1 and 0, 0 and 1, 0 and 0 +13 print 1 or 1, 1 or 0, 0 or 1, 0 or 0 +15 print 1 xor 1, 1 xor 0, 0 xor 1, 0 xor 0 +20 print 1 eqv 1, 1 eqv 0, 0 eqv 1, 0 eqv 0 +30 print 1 imp 1, 1 imp 0, 0 imp 1, 0 imp 0 +40 print 63 and 16, "=16?" +50 print 15 and 14, "=14?" +60 print -1 and 8, "=8?" +70 print 4 or 2, "=6?" +80 print 10 or 10 , "is 10?" +90 print -1 or -2 "=-1?" +100 print not 13 +110 print -(13+1) diff --git a/lang/basic/test/test30.b b/lang/basic/test/test30.b new file mode 100644 index 000000000..81b9a632b --- /dev/null +++ b/lang/basic/test/test30.b @@ -0,0 +1,8 @@ +100 rem writing to a file +110 open "o", #2, "tst/output" +113 open "i", #3, "tst/output" +120 a$="CAMERA": b$="93604-1" +130 write a$,b$ +140 write #2, a$, b$ +145 input #3, b$: print b$ +150 write #3, a$, b$ diff --git a/lang/basic/test/test31.b b/lang/basic/test/test31.b new file mode 100644 index 000000000..be46606d5 --- /dev/null +++ b/lang/basic/test/test31.b @@ -0,0 +1,11 @@ +10 a$(0)= "fbc" +11 a$(1)= "fcc" +12 a$(2)= "abb" +90 'bubble sort array +100 j=2: flips=1 'one more pass +110 while flips +115 flips=0 +120 for i=0 to j-1 +130 if a$(i)>a$(i+1) then swap a$(i),a$(i+1): flips=1 +140 nexti +150 wend diff --git a/lang/basic/test/test32.b b/lang/basic/test/test32.b new file mode 100644 index 000000000..fa1d3c7f6 --- /dev/null +++ b/lang/basic/test/test32.b @@ -0,0 +1,5 @@ + 10 rem mid statement and function + 20 a$= "kansas city, mo" + 25 print mid$(a$,14) + 45 print mid$(a$,3,3) + 55 print mid$(a$,33) diff --git a/lang/basic/test/test33.b b/lang/basic/test/test33.b new file mode 100644 index 000000000..0c5281459 --- /dev/null +++ b/lang/basic/test/test33.b @@ -0,0 +1,6 @@ +10 rem function parameters +20 def fnf1(x%,s$)= 3123 +30 print fnf1(1,"help") +40 print fnf1(3.12,"xx") +50 rem doet i goed print fnf1("help",3) +60 rem GOED print fnf1(4) diff --git a/lang/basic/test/test34.b b/lang/basic/test/test34.b new file mode 100644 index 000000000..dd6b86555 --- /dev/null +++ b/lang/basic/test/test34.b @@ -0,0 +1,4 @@ +10 rem multidimensional arrays +20 t(3,4)= 4 +30 print t(0,0) +40 print t(3,4) diff --git a/lang/basic/test/test35.b b/lang/basic/test/test35.b new file mode 100644 index 000000000..1598676ed --- /dev/null +++ b/lang/basic/test/test35.b @@ -0,0 +1,2 @@ +10 rem call external routine +20 call time(v)