Draw Poker from “51 Game Programs For Timex Sinclair 1000 and 1500โ (p.153-169) by Tim Hartnell.
Appears on
Library tape of the Indiana Sinclair Timex User’s Group.
Source Code
1 REM THIS GAME COULD STAND SOME IMPROVEMENT IN AREA OF BETTING FLEXIBILITY AND GRAPHICS. THERE MAY STILL BE SOME ERRORS IN HAND EVALUATION,BUT FEW. 2 REM ORIGINAL WRITTEN BY HANS MEIER OF RUSTENBURG, SOUTH AFRICA AND VERY GOOD FOR A TS1000 EFFORT BUT IT CLEARLY DOES NOT TAKE ADVANTAGE OF TS2068 STRENGTHS. 3 REM CAN YOU IMPROVE??? 10 REM POKER FROM "51 GAME PROGRAMS FOR TIMEX SINCLAIR 1000 AND 1500"(P.153-169) BY TIM HARTNELL--ADAPTATION FOR TS2068 FROM TS1000 PROGRAM 11 REM SHUFFLE CARDS 12 LET P=0: REM ERRORTRAP 20 LET C$="" 30 PRINT AT 20,0,,"STAND BY, PLEASE", 40 GO SUB 2020 50 RANDOMIZE 60 LET C$="" 70 LET R=INT (RND*52)*2+1 80 LET X$=A$(R TO )+A$( TO R-1) 90 FOR L=1 TO 18 100 LET R=INT (RND*(LEN X$/2))*2+1 110 LET C$=C$+X$(R TO R+1) 120 LET X$=X$( TO R-1)+X$(R+2 TO ) 130 NEXT L 140 PRINT AT 21,0;"READY_PRESS ENTER " 150 INPUT R$ 160 CLS 170 LET A=0 180 GO SUB 0430 190 RETURN 200 REM SORT HI-LO 210 LET R=1 220 FOR L=1 TO 7 STEP 2 230 IF CODE K$(L)<CODE K$(L+2) THEN GO SUB 270 240 NEXT L 250 IF R=0 THEN GO TO 200 260 RETURN 270 LET E$=K$(L TO L+1) 280 LET K$(L TO L+1)=K$(L+2 TO L+3) 290 LET K$(L+2 TO L+3)=E$ 300 LET R=0 310 RETURN 320 REM CHANGE CARD VALUES 330 FOR L=1 TO 9 STEP 2 340 IF K$(L)=":" THEN LET K$(L)="T" 350 IF K$(L)=";" THEN LET K$(L)="J" 360 IF K$(L)="<" THEN LET K$(L)="Q" 370 IF K$(L)="=" THEN LET K$(L)="K" 380 IF K$(L)=">" THEN LET K$(L)="A" 390 IF K$(L+1)="E" THEN LET K$(L+1)="H" 400 IF K$(L+1)="F" THEN LET K$(L+1)="S" 410 NEXT L 420 RETURN 430 REM CARD OUTLINE 440 FOR B=1 TO 25 STEP 6 450 PRINT AT A,B;"\:'\..\..\..\..\. ";AT A+1,B;"\: \: ";AT A+2,B;"\: \ :";AT A+3,B;"\: \: ";AT A+4,B;"\: \ :";AT A+5,B;"\: \ :";AT A+6,B;"\:.\..\..\..\..\.:" 460 NEXT B 470 RETURN 480 REM CARD VALUES 490 FOR A=2 TO 26 STEP 6 500 PRINT AT B,A;K$(SGN PI);AT B+2,A+1;K$(P2);AT B+4,A+2;K$(SGN PI) 505 REM THIS IS PRINTING DISPLAY CARDS 510 LET K$=K$(PI TO ) 520 NEXT A 530 RETURN 540 REM DETERMINE HAND VALUES 550 LET V=CODE K$ 560 IF K$(SGN PI)=K$(PI) AND K$(SGN PI)=K$(5) AND K$(7)=K$(9) OR K$(SGN PI)=K$(PI) AND K$(5)=K$(7) AND K$(5)=K$(9) THEN GO TO 0810 570 IF K$(SGN PI)=K$(PI) AND K$(SGN PI)=K$(5) AND K$(SGN PI)=K$(7) OR K$(PI)=K$(5) AND K$(PI)=K$(7) AND K$(PI)=K$(9) THEN GO TO 0860 580 IF K$(SGN PI)=K$(PI) AND K$(SGN PI)=K$(5) OR K$(PI)=K$(5) AND K$(PI)=K$(7) OR K$(5)=K$(7) AND K$(5)=K$(9) THEN GO TO 0760 590 IF K$(SGN PI)=K$(PI) AND K$(5)=K$(7) OR K$(SGN PI)=K$(PI) AND K$(7)=K$(9) OR K$(PI)=K$(5) AND K$(7)=K$(9) THEN GO TO 0710 600 IF K$(SGN PI)=K$(PI) OR K$(PI)=K$(5) OR K$(5)=K$(7) OR K$(7)=K$(9) THEN GO TO 0660 610 IF CODE K$(SGN PI)=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 THEN LET V=200+CODE K$ 620 IF CODE K$(P2)=CODE K$(4) AND CODE K$(4)=CODE K$(6) AND CODE K$(6)=CODE K$(8) AND CODE K$(8)=CODE K$(10) THEN LET V=250+CODE K$ 630 IF K$(P2)=K$(4) AND K$(4)=K$(6) AND K$(6)=K$(8) AND K$(8)=K$(10) AND CODE K$(SGN PI)=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 THEN LET V=400+CODE K$ 640 IF K$(P2)=K$(4) AND K$(4)=K$(6) AND K$(6)=K$(8) AND K$(8)=K$(10) AND CODE K$=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 AND CODE K$=62 THEN LET V=450+CODE K$ 650 RETURN 660 FOR L=1 TO 7 STEP 2 670 IF K$(L)=K$(L+2) THEN GO TO 690 680 NEXT L 690 LET V=70+CODE K$(L) 700 RETURN 710 FOR L=1 TO 3 STEP 2 720 IF K$(L)=K$(L+2) THEN GO TO 740 730 NEXT L 740 LET V=120+CODE K$(L) 750 RETURN 760 FOR L=1 TO 5 STEP 2 770 IF K$(L)=K$(L+2) THEN GO TO 790 780 NEXT L 790 LET V=170+CODE K$(L) 800 RETURN 810 FOR L=1 TO 5 STEP 4 820 IF K$(L)=K$(L+2) AND K$(L)=K$(L+4) THEN GO TO 0840 830 NEXT L 840 LET V=320+CODE K$(L) 850 RETURN 860 FOR L=1 TO 3 STEP 2 870 IF K$(L)=K$(L+2) THEN LET V=370+CODE K$(L) 880 NEXT L 890 RETURN 900 REM TIMEX/SINCLAIR DECIDES HOW MANY CARDS TO DRAW 910 LET O$=K$ 920 LET T=0 930 IF V>220 THEN RETURN 940 IF V>120 THEN GO TO 1190 950 IF V>70 THEN GO TO 1330 960 IF K$(P2)=K$(4) AND K$(P2)=K$(6) AND K$(P2)=K$(8) OR K$(P2)=K$(4) AND K$(P2)=K$(6) AND K$(P2)=K$(10) OR K$(P2)=K$(4) AND K$(P2)=K$(8) AND K$(P2)=K$(10) OR K$(4)=K$(6) AND K$(4)=K$(8) AND K$(4)=K$(10) THEN GO TO 1420 970 IF K$(P2)=K$(4) AND K$(P2)=K$(6) OR K$(P2)=K$(4) AND K$(P2)=K$(8) OR K$(P2)=K$(4) AND K$(P2)=K$(10) OR K$(P2)=K$(6) AND K$(P2)=K$(8) OR K$(P2)=K$(4) AND K$(P2)=K$(10) OR K$(P2)=K$(6) AND K$(P2)=K$(10) OR K$(4)=K$(6) AND K$(4)=K$(8) OR K$(4)=K$(8) AND K$(4)=K$(10) OR K$(6)=K$(8) AND K$(6)=K$(10) OR K$(6)=K$(4) AND K$(6)=K$(10) THEN GO TO 1020 980 IF CODE K$(SGN PI)=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 OR CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 OR CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 THEN GO TO 1110 990 LET K$(PI TO )=C$( TO 8) 1000 LET T=4 1010 RETURN 1020 IF K$(P2)=K$(4) AND K$(P2)=K$(6) OR K$(P2)=K$(4) AND K$(P2)=K$(8) OR K$(P2)=K$(4) AND K$(P2)=K$(10) OR K$(P2)=K$(6) AND K$(P2)=K$(10) OR K$(P2)=K$(6) AND K$(P2)=K$(8) OR K$(P2)=K$(10) THEN LET G$=K$(P2) 1030 IF K$(4)=K$(6) AND K$(4)=K$(8) OR K$(4)=K$(6) AND K$(4)=K$(10) OR K$(4)=K$(8) AND K$(4)=K$(10) THEN LET G$=K$(4) 1040 IF K$(6)=K$(8) AND K$(6)=K$(10) OR K$(6)=K$(8) AND K$(6)=K$(10) THEN LET G$=K$(6) 1050 FOR L=2 TO 10 STEP 2 1060 IF K$(L)<>G$ THEN LET K$(L-1 TO L)=C$( TO 2) 1070 LET C$=C$(PI TO ) 1080 NEXT L 1090 LET T=2 1100 RETURN 1110 IF CODE K$(SGN PI)=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 OR CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 THEN GO TO 1500 1120 IF CODE K$(SGN PI)=CODE K$(PI)+1 THEN LET O$(7 TO 10)=C$( TO 4) 1130 IF CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 THEN LET O$(9 TO 10)=C$(PI TO 4) 1140 IF CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 THEN LET O$( TO 2)=C$( TO 2) 1150 IF CODE K$(7)=CODE K$(9)+1 THEN LET O$( TO 4)=C$( TO 4) 1160 LET T=2 1170 LET K$=O$ 1180 RETURN 1190 IF V>150 THEN GO TO 1260 1200 IF K$(SGN PI)=K$(PI) AND K$(5)=K$(7) THEN LET O$(9 TO )=C$( TO 2) 1210 IF K$(SGN PI)=K$(PI) AND K$(7)=K$(9) THEN LET O$(5 TO 6)=C$( TO 2) 1220 IF K$(PI)=K$(5) AND K$(7)=K$(9) THEN LET O$( TO 2)=C$( TO 2) 1230 LET T=1 1240 LET K$=O$ 1250 RETURN 1260 IF K$(SGN PI)=K$(PI) AND K$(SGN PI)=K$(5) THEN LET O$(7 TO )=C$( TO 4) 1270 IF K$(PI)=K$(5) AND K$(PI)=K$(7) THEN LET O$( TO 2)=C$( TO 2) 1280 IF K$(PI)=K$(5) AND K$(PI)=K$(7) THEN LET O$(9 TO )=C$(PI TO 4) 1290 IF K$(5)=K$(7) AND K$(5)=K$(9) THEN LET O$( TO 4)=C$( TO 4) 1300 LET T=2 1310 LET K$=O$ 1320 RETURN 1330 IF K$(SGN PI)=K$(PI) THEN LET O$(5 TO )=C$( TO 6) 1340 IF K$(PI)=K$(5) THEN LET O$( TO 2)=C$( TO 2) 1350 IF K$(PI)=K$(5) THEN LET O$(7 TO 10)=C$(PI TO 6) 1360 IF K$(5)=K$(7) THEN LET O$( TO 4)=C$( TO 4) 1370 IF K$(5)=K$(7) THEN LET O$(9 TO )=C$(5 TO 6) 1380 IF K$(7)=K$(9) THEN LET O$( TO 6)=C$( TO 6) 1390 LET T=3 1400 LET K$=O$ 1410 RETURN 1420 IF K$(P2)=K$(4) OR K$(P2)=K$(6) THEN LET V$=K$(P2) 1430 IF K$(P2)<>K$(4) AND K$(4)=K$(6) THEN LET V$=K$(4) 1440 FOR L=2 TO 10 STEP 2 1450 IF K$(L)<>V$ THEN LET K$(L-1 TO L)=C$( TO 2) 1460 LET C$=C$(PI TO ) 1470 NEXT L 1480 LET T=1 1490 RETURN 1500 IF CODE K$(SGN PI)=CODE K$(PI)+1 AND CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 THEN LET O$(9 TO )=C$( TO 2) 1510 IF CODE K$(PI)=CODE K$(5)+1 AND CODE K$(5)=CODE K$(7)+1 AND CODE K$(7)=CODE K$(9)+1 THEN LET O$( TO 2)=C$( TO 2) 1520 LET K$=O$ 1530 LET T=1 1540 RETURN 1550 REM BETTING ROUTINE 1560 LET C=0 1570 IF MV>200 THEN LET C=MV/50 1580 IF MV>200 THEN GO TO 1680 1590 LET X=RND 1600 IF X>.9 THEN LET C=8 1610 IF C=8 THEN GO TO 1680 1620 IF X>.45 OR BTG<3 THEN LET C=2 1630 IF C=2 THEN GO TO 1680 1640 LET Y=Y+BTG 1650 LET WL=5 1660 GO SUB 1940 1670 GO TO 3190 1680 FOR L=1 TO C 1690 PRINT AT 19,0;"I SEE YOU AND RAISE YOU $";BTG, 1700 PRINT AT 21,0;"ENTER YOUR BET",, 1710 GO SUB 2020 1720 INPUT I 1725 LET BTG=I 1730 IF Y<2*BTG OR I=0 OR I=BTG OR I=2*BTG THEN GO TO 1760 1740 PRINT AT 21,0;"SEE OR RAISE ME?" 1750 GO TO 1720 1760 LET WL=WL+I 1770 LET Y=Y-I 1780 IF Y<BTG THEN GO TO 1980 1790 IF I=0 THEN GO TO 3150 1800 IF I=BTG THEN GO TO 1880 1810 PRINT AT 19,0;"SO YOU SEE ME AND RAISE ME...", 1820 GO SUB 1950 1830 IF MV<100 AND L>3 AND RND>=.6 THEN GO TO 3170 1840 NEXT L 1850 GO SUB 1950 1860 PRINT AT 19,0;"I SEE YOU...",, 1870 RETURN 1880 PRINT AT 19,0;"SO YOU SEE ME...", 1890 RETURN 1900 REM NAME THE HANDS 1905 REM THIS AREA OK IF CODE K$WAS PRODUCING CORRECT VALUES 1906 LET J=V 1910 IF J<80 THEN PRINT AT B-1,0;"A HIGH CARD" 1911 IF J>80 AND J<135 THEN PRINT AT B-1,0;"A PAIR" 1912 IF J>134 AND J<182 THEN PRINT AT B-1,0;"TWO PAIRS" 1913 IF J>182 AND J<233 THEN PRINT AT B-1,0;"THREES" 1914 IF J>232 AND J<280 THEN PRINT AT B-1,0;"A STRAIGHT" 1915 IF J>279 AND J<330 THEN PRINT AT B-1,0;"A FLUSH" 1916 IF J>329 AND J<380 THEN PRINT AT B-1,0;"A FULL HOUSE" 1917 IF J>379 AND J<430 THEN PRINT AT B-1,0;"FOUR OF A KIND" 1918 IF J>429 AND J<480 THEN PRINT AT B-1,0;"A STRAIGHT FLUSH" 1919 IF J>479 THEN PRINT AT V-1,0;"A ROYAL FLUSH" 1930 RETURN 1940 REM DELAY LOOP 1950 FOR T=1 TO 90 1960 NEXT T 1970 RETURN 1980 GO SUB 2050 1990 PRINT AT 19,0;"YOU WILL HAVE TO SEE ME...": 2000 GO SUB 1950 2010 RETURN 2020 PRINT AT 21,18;"YOU HAVE $";Y 2030 RETURN 2040 REM START OF PROGRAM 2041 BORDER 2: PAPER 6: INK 0: BRIGHT 1: CLS 2045 POKE 23658,8: REM SETTING CAPS LOCK 2050 LET A$="2C3C4C5C6C7C8C9C:C;C<C=C>C2D3D4D5D6D7D8D9D:D;D<D=D>D2E3E4E5E6E7E8E9E:E;E<E=E>E2F3F4F5F6F7F8F9F:F;F<F=F>F" 2060 LET P2=2 2070 DIM M$(2,10) 2080 DIM Y$(2,10) 2090 LET BT=0 2100 LET Y=250 2110 PRINT AT 9,4;"TIMEX/SINCLAIR POKER" 2120 REM INSTRUCTIONS 2130 PRINT AT 20,0;"DO YOU REQUIRE INSTRUCTIONS? (Y OR N)" 2140 IF INKEY$<>"" THEN GO TO 2140 2150 IF INKEY$="" THEN GO TO 2150 2160 LET S$=INKEY$ 2170 IF S$="Y" THEN GO TO 3300 2180 GO SUB 0010 2190 REM DEAL HANDS 2200 FOR L=1 TO 9 STEP 2 2210 LET M$(1,L TO L+1)=C$( TO 2) 2220 LET Y$(1,L TO L+1)=C$(PI TO 4) 2230 LET C$=C$(5 TO ) 2240 NEXT L 2250 LET K$=Y$(SGN PI) 2260 GO SUB 0200 2270 LET Y$(SGN PI)=K$ 2280 GO SUB 0320 2290 LET Y$(P2)=K$ 2300 REM INITIAL STAKE 2310 LET Y=Y-5 2320 LET B=1 2330 GO SUB 0480 2340 LET K$=M$(SGN PI) 2350 REM NUMBERS UNDER CARDS 2360 PRINT AT 7,3;"1";AT 7,9;"2";AT 7,15;"3";AT 7,21;"4";AT 7,27;"5" 2370 GO SUB 0200 2380 REM DISCARD WHICH CARDS? 2390 PRINT AT 19,0;"SWAP WHICH CARD? (IE.,PRESS 2 FOR NO.2,ETC. AND/OR <P> TO PASS. DISCARD OR NOT--PRESS <P>)", 2400 FOR L=1 TO 4 2410 IF INKEY$<>"" THEN GO TO 2410 2420 IF INKEY$="" THEN GO TO 2420 2430 LET T$=INKEY$ 2440 IF T$="P" THEN GO TO 2510 2450 IF T$<"1" OR T$>"5" THEN GO TO 2410 2460 PRINT AT 7,VAL T$*6-3;"*" 2470 LET T=VAL T$*2-1 2480 LET Y$(1,T TO T+1)=C$( TO 2) 2490 LET C$=C$(PI TO ) 2500 NEXT L 2510 PRINT AT 19,0,,,,TAB 10;"DEALING", 2520 LET K$=Y$(SGN PI) 2530 GO SUB 0200 2540 LET Y$(SGN PI)=K$ 2550 GO SUB 0320 2560 LET Y$(P2)=K$ 2570 LET B=1 2580 GO SUB 0480 2590 PRINT AT 7,0,, 2600 PRINT AT 21,0;"BET TILL NOW $5",, 2610 GO SUB 2020 2620 LET K$=Y$(SGN PI) 2630 GO SUB 0540 2640 LET YV=V 2650 LET K$=M$(SGN PI) 2660 GO SUB 0540 2670 GO SUB 0900 2680 PRINT AT 19,0;"DEALER TAKES ";T;" CARD"+("S" AND T<>1), 2690 LET M$(SGN PI)=K$ 2700 GO SUB 0200 2710 LET M$(SGN PI)=K$ 2720 GO SUB 0320 2730 LET M$(P2)=K$ 2740 LET A=10 2750 GO SUB 0430 2760 LET K$=M$(SGN PI) 2770 GO SUB 0540 2780 LET MV=V 2790 REM BETTING BEGINS 2800 PRINT AT 21,0;"YOUR BET?",, 2810 GO SUB 2020 2820 INPUT BTG 2830 LET BTG=INT BTG 2840 IF BTG=0 THEN GO TO 3150 2850 IF BTG>Y OR BTG>25 THEN PRINT AT 21,0,, 2860 PRINT AT 21,0;("YOU DO NOT HAVE THAT MUCH..." AND BTG>Y)+("LIMIT IS $25" AND BTG>25) 2870 IF BTG>Y OR BTG>25 THEN GO SUB 2020 2880 IF BTG>Y OR BTG>25 THEN GO TO 2820 2890 IF BTG>Y OR Y-BTG<BTG THEN LET S=1 2900 LET Y=Y-BTG 2910 LET WL=BTG+5 2920 GO SUB 1550 2930 LET K$=M$(P2) 2940 LET B=11 2950 GO SUB 490 2960 LET J=YV 2970 GO SUB 1900 2980 PRINT AT 19,0,,,,AT 8,10;"YOU HAVE ";YV 2990 LET J=MV 3000 GO SUB 1900 3010 PRINT AT 18,10;"I HAVE ";MV 3020 GO SUB 1940 3030 REM WHO WINS 3040 PRINT AT 21,0,,AT 21,0;("OK...,YOU WIN" AND YV>MV)+("TOUGH LUCK, I WIN" AND MV>YV)+("IT IS A DRAW..." AND MV=YV) 3050 REM ADJUST MONEY 3060 IF YV>MV THEN LET Y=Y+WL*2 3070 IF YV=MV THEN LET Y=Y+WL 3080 GO SUB 2020 3090 GO SUB 1940 3100 GO SUB 1940 3110 IF Y>2000 THEN GO TO 3220 3120 IF Y<6 THEN GO TO 3270 3130 GO TO 2180 3140 REM VARIOUS REMARKS 3150 PRINT AT 19,0;"SO YOU ARE CHICKEN.....?",,, 3160 GO TO 3080 3170 LET WL=WL-I 3180 LET Y=Y+I 3190 PRINT AT 19,0;"I AM OUT..........",,, 3195 PRINT AT 21,0,, 3200 LET Y=Y+WL*2 3210 GO TO 3080 3220 GO SUB 1940 3230 GO SUB 1940 3240 CLS 3250 PRINT AT 10,0;"WELL, THAT BEATS ME. I AM GOING HOME. BYE-BYE FOR NOW." 3260 STOP 3270 CLS 3280 PRINT AT 10,0;"IT APPEARS YOU HAVE NO MORE CASH. THANKS AND BYE-BYE." 3290 STOP 3300 CLS 3310 PRINT '" THIS IS A GAME OF DRAW POKER PLAYED BY YOU AGAINST THE 2068 TIMEX/SINCLAIR" 3320 PRINT '" YOU WILL BE DEALT FIVE CARDS, AND THEN BE ASKED WHICH ONES YOU WISH TO DISCARD. YOU MAY DISCARD A MAXIMUM OF FOUR CARDS." 3330 PRINT " ON EACH DEAL YOUR TOTAL WILL AUTOMATICALLY BE DEBITED WITH $5 ANTE" 3340 PRINT '" THE MAXIMUM INITIAL BET IS $25. THEREAFTER, YOU MUST ALWAYS DOUBLE OR SEE OPPONENT'S HAND. TO THROW IN YOUR CARDS,ENTER <0>." 3350 PRINT '" GOOD LUCK..." 3355 PAUSE 360 3360 GO TO 2140 3370 STOP 9998 SAVE "POKER 2" LINE 2040