Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 11,047
|
Post by Brad Nelson on Aug 4, 2023 19:23:38 GMT -8
The amazing thing too is just the maintenance of the code. I had a few more bugs to squash. One of them is that "Ace, 2, 3, 4, 5" was not evaluating as a straight. That's because the cards (for the purposes of the program) are valued like this: 2,3,4,5,6,7,8,9,10,11(jack),12(queen),13(king),A(14). And it will evaluate an ace-high straight just fine. It wasn't until I ran into a wheel by chance (A,2,3,4,5) that I realized I needed to code a special case for this, which I did.
I also coded a special case for a Royal Flush. That's completely superfluous, of course. But what the heck.
And I've seen videos and read descriptions about the amazing (amazing doesn't begin to describe it) abilities that the cell's machinery has of proofreading and repairing DNA. Honest to god, I have no idea how it does this. But I've read numbers that say that without it, we would very quickly degenerate and die. With the error-detection and correction (two vital and distinct aspects), the error rate is cut down to (if memory serves) something like one in a hundred billion.
How does DNA repair itself? How can it know what is supposed to be where? I've never read an explanation for this. All I know is that it happens at lightening speed. They are (to my knowledge) writing few, if any, software programs today that fix their own bugs.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 11,047
|
Post by Brad Nelson on Aug 8, 2023 12:40:03 GMT -8
I've partially added hand comparison...in order to determine a winner. Think of the steps of complications like this: 1) Deal a random poker hand (done) 2) Discard and draw new cards (done) 3) Evaluate final hand (in terms of one-pair, two-pair, flush, etc) (done) The next step is proving as challenging as the steps above. It's simple, in theory. It takes us but a second to look at two different poker hands and see which is the winner. But it's proving quite complex to do this in step-by-step programming. So far I've instituted a two-step process: 1) Simple Evaluation: If, say, Artler has 2-pair and KFF and I both have one-pair, then you don't need a fine-grained evaluation. You just need to somehow mark the overall category of the hands from 1 (high card) to 9 (straight flush) and if one person has a poker hand of a higher category than the rest, no other complicated Algore-rhythm is needed. And that was easy enough (more or less) to implement. 2) Fine-Grained Evaluation: This is what you need if two or more players have the same rank-of-hand. If KFF has two-pair and Artler has two-pair (and I have one-pair or high card) then we have to do a hand-to-hand, card-by-card comparison between KFF and Artler. In the case of comparing "high card" hands for a more fine-grained evaluation, we need to store the values of all 5 cards (don't need the suit) for each player and compare them to the other hands. You start with the highest card. See if one guy's high card is higher than another guy's or everyone else's. If so, then try the second-highest card, etc. If all five cards match (as unlikely as that it, but they could), then you need to mark it in your Algore-rhythm as a tie. The general gist of programming can be easy. It's tying up all the exceptions and loose ends that can take a lot of time...if you spot them at all the first time around. And, come to think of it, I'm not sure I've programmed in the distinction between a two-man tie or a three-man tie. So right now, for the "fine-grained evaluation," I've got it working if all of us have a high card hand. And here's how that looks. The "1"s above "Brad Wins" are a debugging tool. They show the rank of the hands (1 for "high card"). And I rigged it to try to make it all come out high card for testing purposes. And as you can see, it seems by rigging things is the only way I can win at my own game.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 11,047
|
Post by Brad Nelson on Aug 11, 2023 8:52:31 GMT -8
Here's the latest incarnation of R&T's Poker Playing Peculiarity.
I think Mr. Kung can use the Chrome browser. I find it translates other languages well...including Greek. But, the fact is, in six months, if I look back at this, it will be Greek to me as well.
Mostly the further work has been in optimizing the program and fixing bugs. And I'm sure there are still bugs left. The logic of doing some of this stuff is (for me) mind-boggling. The toughest part of the "comparing hands to determine a winner" routine was dealing with two pair. That took a surprising amount of code (37 lines) compared to dealing with a straight (3 lines), although both used data from earlier parts of the program.
Some of the optimizing was simply mechanical. It consisted of a combination of removing unneeded spaces, combining two (or more) program statements into one statement, shortening the comments, and shortening the names of some of the variables. I started with this program leaving about 2284 bytes free (in a 64K emulator) to leaving about 7141 bytes free. Some of the savings came in optimizing the structure of the program. There were duplicate Algore-rhythms, for example, that could be combined into one instead of written out twice. That sort of thing.
This, of course, now leaves room for implementing a couple more features such as: 1) Allowing wagering and/or keeping score. 2) Universalizing it so that it's not hard-coded to just three players (a feature I'll not likely ever do because I do think it would take too much work). You could allow one to five players, for example. Why, when it's just me playing it? Good question. That's probably why it won't get implemented.
Maybe I could write something more useful, such as how to hack votes for Trump for the next election. But that would clearly require learning Old Latin, or even Aramaic. That's beyond me at this point.
10 ! LIST "H2:CARDSDRW14FX6.MSL" 20 POKE 710,128:POKE 712,128:POKE 709,14 ! {bkgnd,border,text colors] 30 CLEAR:RANDOMIZE:CLS 60 DIM CARDS$(52),PLAYER$(3,5),HANK$(3),DISCARD$(5),HIGHCARD(5),HRANK(3),ALLVAL(3,5) 70 DIM DECKS(30),HAND$(30),SUTE$(5),FLUSH$(5),COMPARE$(10),COUNT(14),C(5),PLAYLOOP(3),ONEPAIR$(3),TWOPAIR$(3) 80 DIM HIPAIR$(3),LOWPAIR$(3),TRIP$(3),QUAD$(3) 90 !====================create the deck 100 FOR Y=1 TO 52:READ CARDS$(Y):NEXT Y 130 !===================deal 5 cards each to 3 players 140 FOR GAMER=1 TO 3 150 FOR X=1 TO 5 160 R=RND(52) 180 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 160 190 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 200 PLAYER$(GAMER,X)=CARDS$(R) 210 CARDS$(R)=CARDS$(R)+"*" 220 NEXT X 230 NEXT GAMER 240 GOSUB 770 ! {PRINT HANDS} 250 !===================ask for discards 260 FOR Y=1 TO 3 270 PRINT AT(23,1+Y);">" 280 PRINT AT(2,3+(2*Y)):PRINT "#";Y;": ENTER DISCARDS or (S)TAND: "; 290 OPEN #4,"K:" INPUT 300 GET#4,X 310 IF X=155 OR X=83 THEN GOTO 390 ! RETURN OR S IS FOR STANDS 320 IF X<1+48 OR X>5+48 THEN GOTO 300 330 IF INSTR(DISCARD$,CHR$(X)) THEN GOSUB 890:GOTO 300 340 DISCARD$=DISCARD$+CHR$(X):INVERT$=PLAYER$(Y,X-48) 360 FIRST=128+ASC(MID$(INVERT$,1,1)):SECOND=128+ASC(MID$(INVERT$,2,1)) 370 PRINT AT(21+(3*(X-48)),1+Y);CHR$(FIRST);CHR$(SECOND) 380 GOTO 300 390 CLOSE #4:PRINT AT(2,7); 400 PERSON=Y:GOSUB 650 ! {PROCESS DISCARDS} 410 PRINT AT(23,1+Y);" " 420 NEXT Y 430 GOTO 440 ! {PRINT} 440 !===================PRINT FINAL RESULTS 450 PRINT AT(2,12);:GOSUB 770 ! {PRINT HANDS} 460 FOR PLAYLOOP=1 TO 3 470 HTYPE$="" 480 GOSUB 1010 ! {EVALUATE HAND TYPE} 490 GOSUB 1900 ! {GENERAL RANKING OF HAND FROM 1 TO 9} 500 PRINT AT(9,13+PLAYLOOP);HTYPE$ 510 NEXT PLAYLOOP 520 PRINT AT(2,19);HRANK(1);", ";HRANK(2);", ";HRANK(3) 530 GOSUB 2010: IF WIN$="" THEN GOSUB 2090 531 IF WIN=1 THEN WIN$="Brad Wins!!!" 532 IF WIN=2 THEN WIN$="KFF Wins!!!" 533 IF WIN=3 THEN WIN$="Artler Wins!!!" 534 IF WIN=0 THEN WIN$="Tie Game" 540 PRINT AT(2,20);WIN$ 550 PRINT AT(2,21);"PLAY AGAIN?...(N) to exit" 560 OPEN #4,"K:" INPUT 570 GET#4,X 580 IF X=78 THEN END ELSE CLOSE #4:GOTO 30 ! "N" ENDS, ANY OTHER KEY PLAYS AGAIN 590 !===================data for deck of cards 600 DATA AH,2H,3H,4H,5H,6H,7H,8H,9H,TH,JH,QH,KH 610 DATA A`,2`,3`,4`,5`,6`,7`,8`,9`,T`,J`,Q`,K` 620 DATA A#,2#,3#,4#,5#,6#,7#,8#,9#,T#,J#,Q#,K# 630 DATA A{,2{,3{,4{,5{,6{,7{,8{,9{,T{,J{,Q{,K{ 640 !===================choose new from discard 650 FOR LOADLOOP=1 TO LEN(DISCARD$) 660 SLOT=VAL(MID$(DISCARD$,LOADLOOP,1)) 670 R=RND(52) 690 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 670 700 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 710 PLAYER$(PERSON,SLOT)=CARDS$(R) 720 CARDS$(R)=CARDS$(R)+"*" 730 NEXT LOADLOOP 740 DISCARD$="" 750 RETURN 760 !===================print hands 770 HANK$(1)="":HANK$(2)="":HANK$(3)="" 780 FOR PLAYER=1 TO 3 790 FOR CARDS=1 TO 5 800 HANK$(PLAYER)=HANK$(PLAYER)+PLAYER$(PLAYER,CARDS)+" " 810 NEXT CARDS 820 NEXT PLAYER 830 PRINT" 1 2 3 4 5" 840 PRINT" ##############" 850 PRINT "BRAD "," ";HANK$(1) 860 PRINT "KFF "," ";HANK$(2) 870 PRINT "ARTLER "," ";HANK$(3) 880 RETURN 890 !===================deselect discard 900 !-------------------revert previous discard 910 LOC=INSTR(DISCARD$,CHR$(X)):REVERT$=PLAYER$(Y,X-48) 930 FIRST=ASC(MID$(REVERT$,1,1)):SECOND=ASC(MID$(REVERT$,2,1)) 940 PRINT AT(21+(3*(X-48)),1+Y);CHR$(FIRST);CHR$(SECOND) 950 !-------------------truncate discard string 960 DISCARD$=MID$(DISCARD$,1,LOC-1)+MID$(DISCARD$,LOC+3,LEN(DISCARD$)) 970 RETURN 1010 !===================HAND EVALUATOR 1020 SFLAG=0:RFFLAG=0:PAIR=0:THREE=0:FOUR=0:VALUE=0:PARE=0:HIGHCARD$="":HCSTR8=0:VALUE2=0 1040 FOR I=1 TO 14:COUNT(I)=0:NEXT I 1050 FOR I=1 TO 5: HIGHCARD(I)=0:NEXT I 1060 DECK$="2 3 4 5 6 7 8 9 T J Q K A":HAND$=HANK$(PLAYLOOP) 1080 ! IF PLAYLOOP=1 THEN HAND$="2{ Q# Q` 9{ 5`" 1090 ! IF PLAYLOOP=2 THEN HAND$="5{ J` T# 7` J{" 1100 ! IF PLAYLOOP=3 THEN HAND$="Q` 6# J` 9{ Q{" 1110 FOR I=1 TO 5 1120 CARD$=MID$(HAND$,I*3-2,2) 1130 RANK$=LEFT$(CARD$,LEN(CARD$)-1) 1140 VALUE=(INSTR(DECK$,RANK$)+1)/2+1 1150 COUNT(VALUE)=COUNT(VALUE)+1 1160 IF COUNT(VALUE)=2 THEN PARE=PARE+1:IF PARE<2 THEN ONEPAIR$(PLAYLOOP)=RANK$ ELSE TWOPAIR$(PLAYLOOP)=RANK$ 1170 IF I=1 THEN HIGHCARD$=RANK$:VALUE2=VALUE 1180 IF I>1 AND VALUE>VALUE2 THEN VALUE2=VALUE:HIGHCARD$=RANK$ 1190 IF COUNT(VALUE)=3 THEN TRIP$(PLAYLOOP)=RANK$ 1200 IF COUNT(VALUE)=4 THEN QUAD$(PLAYLOOP)=RANK$ 1210 NEXT I 1220 PAIR=0:THREE=0 1240 FOR I=1 TO 14 1250 IF COUNT(I)=2 THEN PAIR=PAIR+1 1260 IF COUNT(I)=3 THEN THREE=THREE+1 1270 IF COUNT(I)=4 THEN FOUR=FOUR+1 1280 NEXT I 1290 !------------------- 1300 IF FOUR=1 THEN HTYPE$="4 of a Kind":RETURN 1310 IF PAIR=1 AND THREE=1 THEN HTYPE$="Full House":RETURN 1320 !-------------------STRAIGHT? 1330 GOSUB 1460 ! {sraight eval} 1340 IF HTYPE$="Straight" THEN SFLAG=1 1350 !-------------------FLUSH? 1360 GOSUB 1720 1370 IF HTYPE$="Flush" THEN RETURN 1380 IF HTYPE$="Straight" THEN RETURN 1390 IF HTYPE$="Straight Flush" THEN RETURN 1400 IF HTYPE$="Royal Flush" THEN RETURN 1410 !------------------- 1420 IF THREE=1 THEN HTYPE$="3 of a Kind": RETURN 1430 IF PAIR=2 THEN HTYPE$="Two Pair": RETURN 1440 IF PAIR=1 THEN HTYPE$="One Pair": RETURN 1450 IF PAIR=0 AND THREE=0 THEN HTYPE$="High Card": RETURN 1460 !===================STRAIGHT EVAL 1480 FOR I=1 TO 5 1490 CARD$=MID$(HAND$,I * 3-2,2) 1500 RANK$=LEFT$(CARD$,LEN(CARD$)-1) 1510 VALUE=(INSTR(DECK$,RANK$)+1)/2+1 1520 C(I)=VALUE 1530 NEXT I 1540 FOR I=1 TO 4 1550 FOR J=I+1 TO 5 1560 IF C(I)>C(J) THEN T=C(I):C(I)=C(J):C(J)=T 1570 NEXT J 1580 HCSTR8=C(5):IF C(5)=14 AND C(1)=2 AND C(2)=3 AND C(3)=4 THEN HCSTR8=5 1590 HCSTR8$=STR$(HCSTR8):HCSTR8$=RIGHT$(HCSTR8$,LEN(HCSTR8$)-1) 1600 IF HCSTR8$="10" THEN HCSTR8$="T" 1610 IF HCSTR8$="11" THEN HCSTR8$="J" 1620 IF HCSTR8$="12" THEN HCSTR8$="Q" 1630 IF HCSTR8$="13" THEN HCSTR8$="K" 1640 IF HCSTR8$="14" THEN HCSTR8$="A" 1650 NEXT I 1660 IF C(1)+1=C(2) AND C(2)+1=C(3) AND C(3)+1=C(4) AND C(4)+1=C(5) THEN HTYPE$ = "Straight" 1670 IF C(5)=14 AND C(1)=2 AND C(2)=3 AND C(3)=4 AND C(4)=5 THEN HTYPE$ = "Straight" 1680 IF C(5)=14 AND C(4)=13 AND C(3)=12 AND C(2)=11 AND C(1)= 10 THEN RFFLAG=1 1690 HIGHCARD(1)=C(5):HIGHCARD(2)=C(4):HIGHCARD(3)=C(3):HIGHCARD(4)=C(2):HIGHCARD(5)=C(1) 1700 FOR XX=1 TO 5:ALLVAL(PLAYLOOP,XX)=HIGHCARD(XX):NEXT XX 1710 RETURN 1720 !===================FLUSH EVAL 1730 FLUSH$="":COMPARE$="" 1740 CARD$=MID$(HAND$,1,2) 1750 SUTE$(1)=MID$(CARD$,2,1) 1760 COMPARE$=SUTE$(1) 1770 FOR I=2 TO 5 1780 CARD$=MID$(HAND$, I * 3 - 2, 2) 1790 SUTE$(I)=MID$(CARD$,2,1) 1800 COMPARE$=SUTE$(I) 1810 IF SUTE$(I-1)<>COMPARE$ THEN FLUSH$="NO" 1820 NEXT I 1830 IF FLUSH$<>"NO" THEN HTYPE$="Flush" 1840 IF FLUSH$<>"NO" AND SFLAG=1 THEN HTYPE$="Straight Flush" 1850 IF FLUSH$<>"NO" AND SFLAG=1 AND RFFLAG=1 THEN HTYPE$="Royal Flush" 1860 RETURN 1890 ! 1900 !===================CALCULATE HAND VALUES 1910 IF HTYPE$="High Card" THEN HTYPE$=HTYPE$+"("+HIGHCARD$+")":HRANK(PLAYLOOP)=1 1920 IF HTYPE$="One Pair" THEN HTYPE$=HTYPE$+" ("+ONEPAIR$(PLAYLOOP)+")":HRANK(PLAYLOOP)=2 1930 IF HTYPE$="Two Pair" THEN HTYPE$=HTYPE$+" ("+ONEPAIR$(PLAYLOOP)+","+TWOPAIR$(PLAYLOOP)+")":HRANK(PLAYLOOP)=3 1940 IF HTYPE$="3 of a Kind" THEN HTYPE$=HTYPE$+"("+TRIP$(PLAYLOOP)+")":HRANK(PLAYLOOP)=4 1950 IF HTYPE$="Straight" THEN HTYPE$=HTYPE$+"("+HCSTR8$+")":HRANK(PLAYLOOP)=5 1960 IF HTYPE$="Flush" THEN HTYPE$=HTYPE$+"("+HCSTR8$+")":HRANK(PLAYLOOP)=6 1970 IF HTYPE$="Full House" THEN HTYPE$=HTYPE$+"("+TRIP$(PLAYLOOP)+")":HRANK(PLAYLOOP)=7 1980 IF HTYPE$="4 of a Kind" THEN HTYPE$=HTYPE$+"("+QUAD$(PLAYLOOP)+")":HRANK(PLAYLOOP)=8 1990 IF HTYPE$="Straight Flush" THEN HTYPE$=HTYPE$+"("+HCSTR8$+")":HRANK(PLAYLOOP)=9 2000 RETURN 2010 !===================SIMPLE EVAL OF WINNER 2020 WIN$="":WIN=4 2030 IF HRANK(1)>HRANK(2) AND HRANK(1)>HRANK(3) THEN WIN$="Brad Wins!!!" 2040 IF HRANK(2)>HRANK(1) AND HRANK(2)>HRANK(3) THEN WIN$="KFF Wins!!!" 2050 IF HRANK(3)>HRANK(2) AND HRANK(3)>HRANK(1) THEN WIN$="Artler Wins!!!" 2060 RETURN 2090 !===================FINE-GRAINED EVAL OF WINNER 2100 FP=0:SP=0:TP=0:WIN=0 2110 IF HRANK(1) AND HRANK(2)>HRANK(3) THEN ON HRANK(1) GOTO 2160,2380,2680,3320,3700,2160,3320,3500,3650 2120 IF HRANK(1) AND HRANK(3)>HRANK(2) THEN ON HRANK(1) GOTO 2160,2380,2680,3320,3700,2160,3320,3500,3650 2130 IF HRANK(2) AND HRANK(3)>HRANK(1) THEN ON HRANK(2) GOTO 2160,2380,2680,3320,3700,2160,3320,3500,3650 2140 IF HRANK(1)=HRANK(2) AND HRANK(1)=HRANK(3) THEN ON HRANK(1) GOTO 2160,2380,2680,3320,3700,2160,3320,3500,3650 2160 ! HIGH CARD OR FLUSH +++++++++++++++++++++++++++ 2170 FP=1:SP=2:TP=3 2180 IF ALLVAL(FP,1)>ALLVAL(SP,1) AND ALLVAL(FP,1)>ALLVAL(TP,1) THEN WIN=FP:GOTO 2370 2190 IF ALLVAL(SP,1)>ALLVAL(FP,1) AND ALLVAL(SP,1)>ALLVAL(TP,1) THEN WIN=SP:GOTO 2370 2200 IF ALLVAL(TP,1)>ALLVAL(FP,1) AND ALLVAL(TP,1)>ALLVAL(SP,1) THEN WIN=TP:GOTO 2370 2210 IF ALLVAL(FP,2)>ALLVAL(SP,2) AND ALLVAL(FP,2)>ALLVAL(TP,2) THEN WIN=FP:GOTO 2370 2220 IF ALLVAL(SP,2)>ALLVAL(FP,2) AND ALLVAL(SP,2)>ALLVAL(TP,2) THEN WIN=SP:GOTO 2370 2230 IF ALLVAL(TP,2)>ALLVAL(FP,2) AND ALLVAL(TP,2)>ALLVAL(SP,2) THEN WIN=TP:GOTO 2370 2240 IF ALLVAL(FP,3)>ALLVAL(SP,3) AND ALLVAL(FP,3)>ALLVAL(TP,3) THEN WIN=FP:GOTO 2370 2250 IF ALLVAL(SP,3)>ALLVAL(FP,3) AND ALLVAL(SP,3)>ALLVAL(TP,3) THEN WIN=SP:GOTO 2370 2260 IF ALLVAL(TP,3)>ALLVAL(FP,3) AND ALLVAL(TP,3)>ALLVAL(SP,3) THEN WIN=TP:GOTO 2370 2270 IF ALLVAL(FP,4)>ALLVAL(SP,4) AND ALLVAL(FP,4)>ALLVAL(TP,4) THEN WIN=FP:GOTO 2370 2280 IF ALLVAL(SP,4)>ALLVAL(FP,4) AND ALLVAL(SP,4)>ALLVAL(TP,4) THEN WIN=SP:GOTO 2370 2290 IF ALLVAL(TP,4)>ALLVAL(FP,4) AND ALLVAL(TP,4)>ALLVAL(SP,4) THEN WIN=TP:GOTO 2370 2300 IF ALLVAL(FP,5)>ALLVAL(SP,5) AND ALLVAL(FP,5)>ALLVAL(TP,5) THEN WIN=FP:GOTO 2370 2310 IF ALLVAL(SP,5)>ALLVAL(FP,5) AND ALLVAL(SP,5)>ALLVAL(TP,5) THEN WIN=SP:GOTO 2370 2320 IF ALLVAL(TP,5)>ALLVAL(FP,5) AND ALLVAL(TP,5)>ALLVAL(SP,5) THEN WIN=TP 2370 RETURN 2380 ! 1 PAIR +++++++++++++++++++++++++++++ 2400 FOR M=1 TO 3 2410 IF ONEPAIR$(M)="T" THEN ONEPAIR$(M)="10" 2420 IF ONEPAIR$(M)="J" THEN ONEPAIR$(M)="11" 2430 IF ONEPAIR$(M)="Q" THEN ONEPAIR$(M)="12" 2440 IF ONEPAIR$(M)="K" THEN ONEPAIR$(M)="13" 2450 IF ONEPAIR$(M)="A" THEN ONEPAIR$(M)="14" 2460 NEXT M 2470 IF VAL(ONEPAIR$(1))>VAL(ONEPAIR$(2)) AND VAL(ONEPAIR$(1))>VAL(ONEPAIR$(3)) THEN WIN=1:GOTO 2670 2480 IF VAL(ONEPAIR$(2))>VAL(ONEPAIR$(1)) AND VAL(ONEPAIR$(2))>VAL(ONEPAIR$(3)) THEN WIN=2:GOTO 2670 2490 IF VAL(ONEPAIR$(3))>VAL(ONEPAIR$(1)) AND VAL(ONEPAIR$(3))>VAL(ONEPAIR$(2)) THEN WIN=3:GOTO 2670 2500 IF VAL(ONEPAIR$(1))=VAL(ONEPAIR$(2)) AND VAL(ONEPAIR$(1))>VAL(ONEPAIR$(3)) THEN FP=1:SP=2 2510 IF VAL(ONEPAIR$(1))=VAL(ONEPAIR$(3)) AND VAL(ONEPAIR$(1))>VAL(ONEPAIR$(2)) THEN FP=1:SP=3 2520 IF VAL(ONEPAIR$(3))=VAL(ONEPAIR$(2)) AND VAL(ONEPAIR$(3))>VAL(ONEPAIR$(1)) THEN FP=2:SP=3 2530 IF ALLVAL(FP,1)>ALLVAL(SP,1) THEN WIN=FP:GOTO 2670 2540 IF ALLVAL(SP,1)>ALLVAL(FP,1) THEN WIN=SP:GOTO 2670 2550 IF ALLVAL(FP,2)>ALLVAL(SP,2) THEN WIN=FP:GOTO 2670 2560 IF ALLVAL(SP,2)>ALLVAL(FP,2) THEN WIN=SP:GOTO 2670 2570 IF ALLVAL(FP,3)>ALLVAL(SP,3) THEN WIN=FP:GOTO 2670 2580 IF ALLVAL(SP,3)>ALLVAL(FP,3) THEN WIN=SP:GOTO 2670 2590 IF ALLVAL(FP,4)>ALLVAL(SP,4) THEN WIN=FP:GOTO 2670 2600 IF ALLVAL(SP,4)>ALLVAL(FP,4) THEN WIN=SP:GOTO 2670 2610 IF ALLVAL(FP,5)>ALLVAL(SP,5) THEN WIN=FP:GOTO 2670 2620 IF ALLVAL(SP,5)>ALLVAL(FP,5) THEN WIN=SP 2670 RETURN 2680 ! 2 PAIR +++++++++++++++++++++++++++++ 2690 FOR M=1 TO 3 2695 IF ONEPAIR$(M)="T" THEN ONEPAIR$(M)="10" 2700 IF ONEPAIR$(M)="J" THEN ONEPAIR$(M)="11" 2710 IF ONEPAIR$(M)="Q" THEN ONEPAIR$(M)="12" 2720 IF ONEPAIR$(M)="K" THEN ONEPAIR$(M)="13" 2730 IF ONEPAIR$(M)="A" THEN ONEPAIR$(M)="14" 2735 IF TWOPAIR$(M)="T" THEN TWOPAIR$(M)="10" 2740 IF TWOPAIR$(M)="J" THEN TWOPAIR$(M)="11" 2750 IF TWOPAIR$(M)="Q" THEN TWOPAIR$(M)="12" 2760 IF TWOPAIR$(M)="K" THEN TWOPAIR$(M)="13" 2770 IF TWOPAIR$(M)="A" THEN TWOPAIR$(M)="14" 2780 NEXT M 2790 FOR N=1 TO 3 2800 IF VAL(ONEPAIR$(N))>VAL(TWOPAIR$(N)) THEN HIPAIR$(N)=ONEPAIR$(N):LOWPAIR$(N)=TWOPAIR$(N) 2810 IF VAL(ONEPAIR$(N))<VAL(TWOPAIR$(N)) THEN HIPAIR$(N)=TWOPAIR$(N):LOWPAIR$(N)=ONEPAIR$(N) 2815 IF LOWPAIR$(N)="" THEN HIPAIR$(N)="" 2820 NEXT N 2830 IF VAL(HIPAIR$(1))>VAL(HIPAIR$(2)) AND VAL(HIPAIR$(1))>VAL(HIPAIR$(3)) THEN WIN=1:GOTO 3050 2840 IF VAL(HIPAIR$(2))>VAL(HIPAIR$(1)) AND VAL(HIPAIR$(2))>VAL(HIPAIR$(3)) THEN WIN=2:GOTO 3050 2850 IF VAL(HIPAIR$(3))>VAL(HIPAIR$(1)) AND VAL(HIPAIR$(3))>VAL(HIPAIR$(2)) THEN WIN=3:GOTO 3050 2860 IF VAL(HIPAIR$(1))=VAL(HIPAIR$(2)) AND VAL(HIPAIR$(1))>VAL(HIPAIR$(3) THEN FP=1:SP=2 2870 IF VAL(HIPAIR$(1))=VAL(HIPAIR$(3)) AND VAL(HIPAIR$(1))>VAL(HIPAIR$(2) THEN FP=1:SP=3 2880 IF VAL(HIPAIR$(3))=VAL(HIPAIR$(2)) AND VAL(HIPAIR$(3))>VAL(HIPAIR$(1) THEN FP=2:SP=3 2890 IF VAL(LOWPAIR$(FP))>VAL(LOWPAIR$(SP)) THEN WIN=FP:GOTO 3050 2900 IF VAL(LOWPAIR$(SP))>VAL(LOWPAIR$(FP)) THEN WIN=SP:GOTO 3050 2910 IF ALLVAL(FP,1)>ALLVAL(SP,1) THEN WIN=FP:GOTO 3050 2920 IF ALLVAL(SP,1)>ALLVAL(FP,1) THEN WIN=SP:GOTO 3050 2930 IF ALLVAL(FP,2)>ALLVAL(SP,2) THEN WIN=FP:GOTO 3050 2940 IF ALLVAL(SP,2)>ALLVAL(FP,2) THEN WIN=SP:GOTO 3050 2950 IF ALLVAL(FP,3)>ALLVAL(SP,3) THEN WIN=FP:GOTO 3050 2960 IF ALLVAL(SP,3)>ALLVAL(FP,3) THEN WIN=SP:GOTO 3050 2970 IF ALLVAL(FP,4)>ALLVAL(SP,4) THEN WIN=FP:GOTO 3050 2980 IF ALLVAL(SP,4)>ALLVAL(FP,4) THEN WIN=SP:GOTO 3050 2990 IF ALLVAL(FP,5)>ALLVAL(SP,5) THEN WIN=FP:GOTO 3050 3000 IF ALLVAL(SP,5)>ALLVAL(FP,5) THEN WIN=SP 3050 RETURN 3320 ! FULL HOUSE (AND 3 OF A KIND)+++++++++++++++++++++++ 3330 FOR M=1 TO 3 3340 IF TRIP$(M)="T" THEN TRIP$(M)="10" 3350 IF TRIP$(M)="J" THEN TRIP$(M)="11" 3360 IF TRIP$(M)="Q" THEN TRIP$(M)="12" 3370 IF TRIP$(M)="K" THEN TRIP$(M)="13" 3380 IF TRIP$(M)="A" THEN TRIP$(M)="14" 3390 NEXT M 3395 IF HRANK(1)<5 AND HRANK(2)<5 AND HRANK(3)<5 THEN GOT0 3430 ! FOR 3 OF A KIND ONLY 3400 IF HRANK(1)=4 THEN TRIP$(1)="" 3410 IF HRANK(2)=4 THEN TRIP$(2)="" 3420 IF HRANK(3)=4 THEN TRIP$(3)="" 3430 IF VAL(TRIP$(1))>VAL(TRIP$(2)) AND VAL(TRIP$(1))>VAL(TRIP$(3)) THEN WIN=1:GOTO 3490 3440 IF VAL(TRIP$(2))>VAL(TRIP$(1)) AND VAL(TRIP$(2))>VAL(TRIP$(3)) THEN WIN=2:GOTO 3490 3450 IF VAL(TRIP$(3))>VAL(TRIP$(1)) AND VAL(TRIP$(3))>VAL(TRIP$(2)) THEN WIN=3 3490 RETURN 3500 ! 4 OF A KIND ++++++++++++++++++++++ 3510 FOR M=1 TO 3 3520 IF QUAD$(M)="T" THEN QUAD$(M)="10" 3530 IF QUAD$(M)="J" THEN QUAD$(M)="11" 3540 IF QUAD$(M)="Q" THEN QUAD$(M)="12" 3550 IF QUAD$(M)="K" THEN QUAD$(M)="13" 3560 IF QUAD$(M)="A" THEN QUAD$(M)="14" 3570 NEXT M 3580 IF VAL(QUAD$(1))>VAL(QUAD$(2)) AND VAL(QUAD$(1))>VAL(QUAD$(3)) THEN WIN=1:GOTO 3640 3590 IF VAL(QUAD$(2))>VAL(QUAD$(1)) AND VAL(QUAD$(2))>VAL(QUAD$(3)) THEN WIN=2:GOTO 3640 3600 IF VAL(QUAD$(3))>VAL(QUAD$(1)) AND VAL(QUAD$(3))>VAL(QUAD$(2)) THEN WIN=3 3640 RETURN 3650 ! STRAIGHT FLUSH (line 3700 for straight) +++++++++++++++++++ 3660 IF HRANK(1)=5 THEN ALLVAL(1,1)=0 3670 IF HRANK(2)=5 THEN ALLVAL(2,1)=0 3680 IF HRANK(3)=5 THEN ALLVAL(3,1)=0 3700 IF ALLVAL(1,1)>ALLVAL(2,1) AND ALLVAL(1,1)>ALLVAL(3,1) THEN WIN=1:GOTO 3780 3710 IF ALLVAL(2,1)>ALLVAL(1,1) AND ALLVAL(2,1)>ALLVAL(3,1) THEN WIN=2:GOTO 3780 3720 IF ALLVAL(3,1)>ALLVAL(1,1) AND ALLVAL(3,1)>ALLVAL(2,1) THEN WIN=3 3780 RETURN
|
|