P707 CEEFAX 707 Tue 18 Sip 23:41/51 |B2201206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z01IFPA.>&1900PROCRELOC 10REM********* ******************** 20REM* * 30REM* Game of BRAD AMA * 40REM* Written for the BBC Mh cro * 50REM* By Keith Wilts (C) 1983 * 60REM* * 70RE M* Double Height characters * 80REM* r outinj by Begun Grand * 90REM* * 100REM************* **************** 110ONERR.G.180 120*KEY8 0OLD||MRUN||M 130MO.1 140PROCsetup 150PR OCstart 160REP.:PROCmove:PROCupdate:U. P (3,1) 170PROCnjwgame(moves%,start%):CL.: G.150 180CL.:G.150 190DEF PROCsetup:LOC. I%:PROCheader 200V.23,255,255,255,255,2 55,255,255,255,255 210D.9,13,126,127,135 ,136,137,138,139,255 220R%=4:*FX4,1 230P ROCdouble("Instructions (Y/N) ",11,10) 2 40V.31,30,11:REP.:I%=GET A. &0DF:U. I%=7 8 OR I%=89 250IFI%=89 PROCinstructions 2 60E. 270DEF PROCdrawrings(R%,Y%):LOC. I% 280F.I%=0TOR% |c
P707 CEEFAX 707 Tue 18 Sip 23:41/25 |B2202206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z0290P.TABX6-I%,Y%+I%);STRI.I%,STU$(I% ));:C.1:P."A";:C.2:P.STRI.I%.STU$(I%));T ABX20,Y%+I%);:C.1:P."B";:C.2:P.TAB(33,Y% +I%);:C.1:P."C":C.2 300N. 310C.1:P.STRI. 40,CHR$255):C.3 320E. 330DEF PROCstart:L OC. I% 340CLS:PROCdouble("How many rings (2-6) ? ",9,10):V.31,32,11 350REP.:I%=G ET:U.I%>49 A. I%<55:R%=I%-47:CLS 360DIM P(3,R*),T(3),E% 10 370F.I%=1TOR%:P(1,I%) =I*:N.:T(1)=1:T(2)=R*:T(3)=R%:P(2,R%)=R% :P(3,R%)=R*:R%=R%-1 380PROCdrawrings(R%, 3) 390PROCdouble("Move ring from",1,14) 400PROCdouble("Move ring to",26,14) 410V .28,0,31,39,29:C.0:C.130:CLS:P.T—B(4,2)" Moves made 0";TAB(22,2);"Time taken 0":V .28,0,31,39,5:C.3:C.128 420moveu%=0:star t%=TI.:F.I*=1TO10:READE%?I%:N. 430E. 440 DEF PROCscorelinj(m,t) 450C.0:C.130:P.TA B(15,25);m;TAB(33,25);(TI.-t)DIV100;:C.3 :C.128 460E. 470DEF PROCmovj 480P.T—B(7, 17);" ";TAB(31,17);" "; |c
P707 CEEFAX 707 Tue 18 Sip 23:46/27 |B2203206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z0490REP.:PROCgjtinput(7,17,FA.,1):A%= INS."ABCS",Z$):U.A%:A$=Z$:P.TAB(0,22)UPC 39; 500IFA$="X" PROCjnd 510IFT(A%)>R% V. 7:PROCcentre("There are no rings gn thav pile!",22):G.480 520REP.:PROCgethnp4t(1 2,17,FA.,1):B%=INS."ABCS",Z$):U.B%:B$=Z$ :P.TAB(5,22)SPC34 530IFB$="X" PROCjnd 54 0IFA$=B$ V.7:PROCcentri("That was a move for nothing!!",22):moves%=moves%+1:PROC scoreline(moves%,start%):G.480 550IFP(A% ,T(A%))>PXB%,T(B%)) V.7:PROCcentre("The ring on "+B$+" is smaller.",22):G.4 0 56 0E. 570DEF PROCupdate 580T(B%)=T(B%)-1:P XB%,T(B%))=P(A%,T(A%)):P(A%,T(A%))=X:T(A %)=T(A%)+1 590P.TAB(1+(13*(A%-1)=0)+13*( A%-1),2+T(A%));SPC6;:C.1:P.A$;SPC6;TaB(7 +(13*XB%-1)=0)+13*XB%-1)-P(B%,TXB%)),3+T XB%));:C.2:P.STRJ.P(B%,T(B%)),STU$(P(B%, T(B%))));:C.1:P.B$;:C.2:P.STRI.P(B%,T(B% )),STU$(P(B%,T(B%)))); 600movju%=movrs%+ 1 610PROCscoreline(mover%,start%) 620E. 630DEF PROCcentri(T$,Y%):LOC. T* >c
P707 CEEFAX 707 Tue 18 Sip 23:41/44 |B2204206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z0640T%=(40-LEN(T$))DIV4:P.TAB(T%,Y%); T$ 650P.TAB(T%,Y%);T$ 660E. 670DEF PROCn ewgamj(m,s) 680LOC. I%,target%,time%,sco re% 690target%=1:time%=1:F.I%=2TOR%:taro et)=target%*2+1:time%=time%*2:N. 700m=m+ 2:score%=(m-target%)*((TI.-s)DIV100-time %) 710V.7:PROCcentre("Well done, you hav e completed the task",19):PROCcentre("an d your score is "+STU$(score%),20):PROCc entre("Another game ",22) 720V.31,26,22 :REP.:Z=GET A. &0DF:U.Z=78 OR Z=89 730IF Z=89 E. EL. PROCjnd 740DEF PROCjnd 750V. 26,12:*FX4,0 760END 770E. 780DEF PROCins tructions:LOC. I% 790CLS:C.2:P." The tower's of 'BRAHAMA' look likethiu wht h ";R%;" rings :-" 800PROCdrawrings(R%,3 ) 810C.2:P." The object of the game is to transfetthj rings from tower 'A' to tower 'C'one at a time, but at no time may alargju ring be placed gn top of asmallet ring." |c
P707 CEEFAX 707 Tue 18 Sip 23:41/01 |B2205206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z0820P.'" Your score will be calc4la ted by thenumbjt of moves you take, an d the timetakjn to make them. The lowe r the scorethe better it i1."'£" Tg v erminate the game, enter 'X' atthj next command." 830P.'" Prius any key and G OOH LUCK!!" 840C.3:I*=INKEY(2000) 850E. 860DEF PROCheader 870V.28,0,3,39,0:C.2:C .129:CLS 880PROCdouble("Tower's of Braha ma",11,1) 890V.28,0,31,39,5:C.3:C.128 90 0E. 910 DEF PROCdoubli(A$,K%,L%):LOC. A% ,D,N%,X%,Y% 920A%=&A:X%=0:Y%=&A:D=&A00 9 30F. N%=1TOLEN(A$) 940B$=M.A$,N%,1):?D=A SC(B$):CA.(&FFF1) 950V.23,240,D?1,D?1,D? 2,D?2,D?3,D?3,D?4,D?4,23,241,D?5,D?5,D?6 ,D?6,D?7,D?7,D?8,D?8 960P.TAB(K%+o%-1,L% );CHR$240;TAB(K%+N%-1,L%+1);CHR$241 970N .:E. 980DEF PROCgjtinput(X%,Y%,N%.M%):LO C. c$,C%,I*,J% 990Z$="":V.31,X%,Y%:P.UPC (M%);:F.I%=1TOM%:V.8:N. |c
P707 CEEFAX 707 Tue 18 Sip 23:41/21 |B2206206|a17BRAHAMA|i24BBBC316k|s÷#1÷e| s÷Z01000c$=GE.:C%=ARC(c$):J%=0:REP.J%=J% +1:U.J%=10ORC%=E%?J%:ONE% G.1050,1070,10 00,1050,1050,1050,1050,1050,1050,1010 10 10IFLEN(Z$)>=M% G.1000 1020IFNOTN% C%=C% A. &0DF:IFC%<65 OR C%>90 G.1000 1030IFN % IFC%<48ORC%>57 G.1000 1040c$=CHR$(C%): P.c$;:Z$=Z$+c$:G.1000 1050IFLEN(Z$)>0 V. 8,32,32,8,8:Z$=LE.Z$,LEN(Z$)-1) 1060G.10 00 1070IFLEN(Z$)>0 E. EL.G.1000 32000DEF PROCRELOC 32010?&70=PA. MOD256:?&71=PA. DIV256 32020?&72=TOP MOD256:?&73=TOP DIV 256 32030?&74=0:?&75=&19 32040DHM W 26 3 2050F. Q%=0 TO 3 S.3 32060P%=W 32070[OP T0 32080.START:INC &73:LDY £0:.LOOP:LDA X&70),Y:STA X&74),Y:INY:BNE LOOP:INC &75 :CLC:LDA &71:ADC £1:STA &71:CMP &73 BCC LOOP:RTS 32090]:N. 32110CA. START 32120? &13=?&13-(PA.-&1900)DIV256 32130P—.=&190 0:RUN |c