PYRMID.200 (c) Copyright 1990 by Paul Globman PYRAMID is a solitaire game often played with a standard deck of cards. The first 28 cards are laid out as shown and the remaining 24 are held in the "pack". The cards available for play are the top card in the pack, the top card in the "waste" pile, and cards at the bottom of the pyramid. The LEFT and RIGHT arrow keys allow you to move the "pointer" to the card you wish to play. The UP arrow "tags" the card above the pointer, the DOWN arrow advances thru the pack. TAGGING ------- If you tag a King, it is removed. If you tag any other card, it will display in reverse video. If you tag a tagged card, it will become untagged. THE GOAL -------- The idea is to remove ALL 52 cards as follows: Tag Kings, and pairs of cards totaling 13 (Jacks are 11, Queens are 12, Aces are 1). THE PACK -------- You can only go thru the pack 3 times. If two adjacent cards in the pack total 13, they may be removed (if you think those cards will not be needed to clear the pyramid). NEW GAME -------- You may abort the current game at any time and begin a new game, or you may abort the current game and replay it, trying a different strategy. Use upper case for a (N)ew game or to (R)eplay current deck. 0 REM PYRMID.BA (c) 1990 by P.Globman 1 ES$=CHR$(27):RV$=ES$+"p":NV$=ES$+"q":DIMC(52),D(30),P(24),PY(57):C$="A23456789TJQK":P$=" "+STRING$(2,152)+" " 2 FORI=27TO31:B$=B$+CHR$(I):NEXT:B$=B$+"NR":X=VAL(RIGHT$(TIME$,2)):X=RND(-VAL(MID$(TIME$,4,2))*60+X) 3 GOSUB27:FORI=1TO52:C(I)=I:NEXT:FORI=1TO52:X=52*RND(1)+1:Y=C(I):C(I)=C(X):C(X)=Y:NEXT 4 RESTORE:T=0:PM=0:K=1:X=49:FORI=1TO7:FORJ=1TOI:READY:PY(Y)=K:D(K)=X+J*4:K=K+1:NEXTJ:X=X+78:NEXTI:D(29)=551 5 D(30)=555:FORI=1TO24:P(I)=C(28+I):NEXT:GOSUB86 6 A$=INKEY$:IFA$=""THEN6 7 A=INSTR(1,B$,A$):IFA=0THEN6 8 ONAGOTO9,10,12,30,14,3,4 9 MENU 10 IFP<>19THENP=P+1:GOSUB91 11 GOTO6 12 IFP<>2THENP=P-1:GOSUB91 13 GOTO6 14 IFT<>0THEN6 15 IF(P2=PT)AND(PA=3)THEN6 16 IFP2=PTTHEN18 17 PP=PP+1:P1=P1-1:P2=P2+1:GOTO19 18 PP=1:PA=PA+1:P1=PT:P2=0 19 GOSUB20:GOTO6 20 IFP2<>PTTHEN23 21 PRINT@D(29)+1," ":IFP2=0THEN24 22 GOTO25 23 X=P(PP)MOD13:PRINT@D(29)+1,MID$(C$,X+1,1);:PRINTCHR$(156+P(PP)MOD4):IFP2<>0THEN25 24 PRINT@D(30)+1," ":GOTO26 25 X=P(PP-1)MOD13:PRINT@D(30)+1,MID$(C$,X+1,1);:PRINTCHR$(156+P(PP-1)MOD4) 26 GOSUB90:GOSUB92:RETURN 27 CLS:FORI=0TO4STEP2:LINE(0+I,0+I)-(239-I,127-I),1,B:NEXT:PRINT@217,"PYRAMID":PRINT@299,"by":PRINT@374,"Paul Globman 28 PRINT@451,"Copyright (c) 1990":LINE(122,10)-(52,102):LINE(122,10)-(192,102):LINE(52,102)-(192,102) 29 LINE(122,10)-(203,91):LINE(192,102)-(203,91):RETURN 30 IF(P=18)OR(P=16)OR(P=15)THEN6 31 ONPGOSUB1,72,73,74,75,76,77,78,79,80,81,82,83,84,1,1,85,1,85:IFP>15THEN42 32 READY:IFY=0THEN6 33 IFPY(Y)=0THEN32 34 IFPY(Y+7)<>PY(Y+8)THEN6 35 IFT=0THEN51 36 IFT=PY(Y)THEN55 37 IFPM=0THEN40 38 SM=C(PY(Y))MOD13+Y2:IFSM<>11THENBEEP:GOTO6 39 GOSUB57:X=15-T:GOSUB58:T=0:PM=0:GOTO6 40 SM=C(T)MOD13+C(PY(Y))MOD13:IFSM<>11THENBEEP:GOTO6 41 GOSUB57:Y=Y2:GOSUB57:T=0:GOTO6 42 IF(P=17)AND(P1=0)THEN6 43 IF(P=19)AND(P2=0)THEN6 44 IFT=0THEN53 45 IFT=15-PTHEN56 46 IFPM=0THEN49 47 IFY2+X<>11THENBEEP:GOTO6 48 X=17:GOSUB58:X=19:GOSUB58:T=0:PM=0:GOTO6 49 IFC(T)MOD13+X<>11THENBEEP:GOTO6 50 Y=Y2:GOSUB57:X=P:GOSUB58:T=0:GOTO6 51 V=C(PY(Y)):Y2=Y:IFVMOD13=12THENGOSUB57:GOTO6 52 T=PY(Y):X=C(T)MOD13:PRINT@D(T)+1,RV$MID$(C$,X+1,1);:PRINTCHR$(156+C(T)MOD4)NV$:GOTO6 53 IFX=12THENX=P:GOSUB58:GOTO6 54 T=15-P:Y2=X:PM=1:PRINT@D(D)+1,RV$MID$(C$,X+1,1);:PRINTCHR$(156+VMOD4)NV$:GOTO6 55 X=C(T)MOD13:PRINT@D(T)+1,MID$(C$,X+1,1);:PRINTCHR$(156+C(T)MOD4);:T=0:GOTO6 56 T=0:PRINT@D(D)+1,MID$(C$,X+1,1);:PRINTCHR$(156+VMOD4):PM=0:GOTO6 57 X=6*(D(PY(Y))MOD40):Z=8*(D(PY(Y))\40)-4:LINE(X,Z)-(X+23,Z+15),0,BF:PY(Y)=0:RETURN 58 FORI=(PP-(X-17)/2)TO23:P(I)=P(I+1):NEXT:P(I)=0:PT=PT-1:IFX=17THENP1=P1-1 59 IFX=19THENP2=P2-1:PP=PP-1 60 GOTO20 61 S=0:FORI=1TO57:S=S+PY(I):NEXT:S=S+P1+P2:Z=0:IFS=0THEN64 62 IFPA<>3THENRETURN 63 X$=" PLEASE TRY AGAIN!":GOTO65 64 X$=" CONGRATULATIONS!!":GOTO66 65 PRINT@200,"";:FORI=1TO10:PRINTSPACE$(30):NEXT 66 LINE(50,72)-(90,72):LINE(70,52)-(20,102):LINE(20,102)-(120,102):LINE(120,102)-(70,52) 67 LINE(69-Z+1,52-(Z-1)/3)-(50,72),0:LINE(69-Z,52-Z/3)-(50,72),1 68 LINE(69-Z+1,52-(Z-1)/3)-(89-2*((Z-1)/4),70-1.3*(Z-1)),0:LINE(69-Z,52-Z/3)-(89-2*(Z/4),70-1.3*Z),1 69 LINE(89-2*((Z-1)/4),70-1.3*(Z-1))-(50,71),0:LINE(89-2*(Z/4),70-1.3*Z)-(50,71):Z=Z+1:IFZ<>7THEN67 70 FORI=1TOLEN(X$):PRINT@334,RIGHT$(X$,I):FORJ=1TO100:NEXT:NEXT:IFS=0THENPRINT@380," You won on"; 71 RETURN 72 RESTORE94:RETURN 73 RESTORE95:RETURN 74 RESTORE96:RETURN 75 RESTORE97:RETURN 76 RESTORE98:RETURN 77 RESTORE99:RETURN 78 RESTORE100:RETURN 79 RESTORE101:RETURN 80 RESTORE102:RETURN 81 RESTORE103:RETURN 82 RESTORE104:RETURN 83 RESTORE105:RETURN 84 RESTORE106:RETURN 85 V=P(PP-(P-17)/2):X=VMOD13:D=29+(P-17)/2:RETURN:END 86 CLS:P=17:FORI=1TO29:X=C(I)MOD13:PRINT@D(I)+1,MID$(C$,X+1,1);:PRINTCHR$(156+C(I)MOD4):GOSUB88:NEXT:PRINTES$"V"; 87 GOSUB91:PRINT@D(29)-80,24:PRINT@D(30)-80,0 88 X=(D(I)MOD40)*6:Y=8*(D(I)\40)-4:LINE(X,Y)-(X+23,Y+15),1,B:PRINT@27,"Esc to Quit":PT=24:P1=24:PRINT@67,"R - Replay 89 PP=1:P2=0:PRINT@107,"N - New Game":PA=1 90 PRINT@392,"Pass"PA;:RETURN 91 PRINT@596+P*2,P$:RETURN 92 PRINT@D(29)-80,ES$"K"P1:PRINT@D(30)-80,P2:IFP1=0THEN61 93 RETURN:DATA 1,8,9,15,16,17,22,23,24,25:DATA 29,30,31,32,33,36,37,38,39:DATA 40,41,43,44,45,46,47,48,49 94 DATA 43,0 95 DATA 36,0 96 DATA 44,29,0 97 DATA 37,22,0 98 DATA 45,30,15,0 99 DATA 38,23,8,0 100 DATA 46,31,16,1,0 101 DATA 39,24,9,0 102 DATA 47,32,17,0 103 DATA 40,25,0 104 DATA 48,33,0 105 DATA 41,0 106 DATA 49,0