|
Post by kungfuzu on Jul 16, 2023 11:21:05 GMT -8
Take it back! You dealt Artler Aces and Eights, the infamous "Dead Man's Hand" which Wild Bill Hickok was holding when shot. Wait. If this is crypto, I suppose it isn't real. Or is a computer simulation similar to those on which the Climate Fraud has been built?
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 16, 2023 13:25:41 GMT -8
That's a good idea. I will create a Climate Change model. I'll need to incorporate an Algore-rhythm that can replicate this function:
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 16, 2023 17:19:38 GMT -8
I think the solution for that is for Herr Artler to put his winnings at risk and play double-or-nothing. If he beats us both, he wins double. If he loses to either, he pays us both double. Either way, the Hickok curse is lifted. Here it goes… This one turned out to be very interesting. I had a pair of nines and couldn’t improve them. KFF was dealt a pair of aces and improved to aces and fives, just missing the Dead Man's Hand by a couple. Artler had a one-card draw to a flush. That's what I figured he'd do so I did it. He got a red card but the wrong suit. So he pays out but the curse is lifted. (The next game I ran, Artler won on a pair of fours. Go figure.)
|
|
|
Post by kungfuzu on Jul 17, 2023 13:30:03 GMT -8
Your post reminds me of other pieces by Southerners who love their land. "To Kill a Mockingbird" comes to mind. Not the part about the crime and trial, but the description of the place and people. I have always said the South ends, and the West begins somewhere around Fort Worth. I think I-35 is probably as good a demarcation line as any.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 17, 2023 14:45:53 GMT -8
I've done a little more work on this draw poker program. And the size has increased considerably because of the addition of error-checking, although a few things have also gotten smaller with some optimizations of the logic and such.
You would suspect that any programmer worth his salt is a conservative. That's because they know how relatively easy it is to build some function. But they also know how hard it is to make it idiot-proof. You have to guard against all the cases for input that wouldn't make any sense or could crash the program.
I've used the simple notation of "12345" for designating the discards. "12345" signifies that you want to throw them all away while "145" says just to throw away the first, fourth, and fifth card." And that's fine and it works for this just-me-playing-it program.
But it wouldn't survive five minutes in a Progressive environment (or sometimes even my own). There are only five cards dealt in five-card-draw. But what happens if you type a "6"? It crashes the program, as does a zero or any alphabetic letter. None of those make sense in designating Card 1, or Card 2 or Card 3 or Card 4 or Card 5.
With the error-trapping installed, these ways of breaking it are eliminated, although if you change your mind about discarding anything (perhaps you've just spotted a straight or a flush), you can enter "0" and gracefully cancel the request to discard.
It's still not perfect. I could add a way to choose how many players and what their names are. But since this is just me running this machine, that's not needed. But it does work very well for what it does.
10 REM "H2:CARDSDRW9E.MSL" 20 CLEAR 30 RANDOMIZE 40 CLS 50 DIM CARDS$(52),PLAYER$(3,5),HAND$(3),DISCARD$(5) 60 !===================create the deck 70 FOR Y = 1 TO 52 80 READ CARDS$(Y) 90 NEXT Y 100 !==================deal 5 cards each to 3 players 110 FOR GAMER = 1 TO 3 120 FOR X = 1 TO 5 130 R=RND(52) 140 IF CARDS$(R)="" THEN END 150 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 130 160 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 170 PLAYER$(GAMER,X)=CARDS$(R) 180 CARDS$(R)=CARDS$(R)+"*" 190 NEXT X 200 NEXT GAMER 210 GOSUB 620 220 !END 230 !===================ask for discards 235 !+++++++++++++++++++PLAYER 1 240 PRINT:INPUT "#1: ENTER DISCARDS or (S)TAND: ";DISCARD$ 250 IF DISCARD$="S" THEN 300 270 GOSUB 730 !{ERROR CHECK} 280 IF REENTER=1 THEN PRINT AT (2,3);:GOTO 240 290 PERSON=1:GOSUB 510 ! {PROCESS DISCARDS} 295 !+++++++++++++++++++PLAYER 2 300 PRINT:INPUT "#2: ENTER DISCARDS or (S)TAND: ";DISCARD$ 310 IF DISCARD$="S" THEN 360 330 GOSUB 730 !{ERROR CHECK} 340 IF REENTER=1 THEN PRINT AT (2,5);:GOTO 300 350 PERSON=2:GOSUB 510 ! {PROCESS DISCARDS} 355 !+++++++++++++++++++PLAYER 3 360 PRINT:INPUT "#3: ENTER DISCARDS or (S)TAND: ";DISCARD$ 370 IF DISCARD$="S" THEN 420 390 GOSUB 730 !{ERROR CHECK} 400 IF REENTER=1 THEN PRINT AT (2,7);:GOTO 360 410 PERSON=3:GOSUB 510 ! {PROCESS DISCARDS} 415 !+++++++++++++++++++ 420 PRINT:GOSUB 620 ! {PRINT HANDS} 430 PRINT:INPUT "PLAY AGAIN? ";ANS2$ 440 IF ANS2$ ="Y" THEN GOTO 20 ELSE END 450 !===================data for deck of cards 460 DATA AH,2H,3H,4H,5H,6H,7H,8H,9H,TH,JH,QH,KH 470 DATA A`,2`,3`,4`,5`,6`,7`,8`,9`,T`,J`,Q`,K` 480 DATA A#,2#,3#,4#,5#,6#,7#,8#,9#,T#,J#,Q#,K# 490 DATA A{,2{,3{,4{,5{,6{,7{,8{,9{,T{,J{,Q{,K{ 500 !===================choose new from discard 510 FOR LOADLOOP = 1 TO LEN(DISCARD$) 520 SLOT=VAL(MID$(DISCARD$,LOADLOOP,1)) 530 R=RND(52) 540 IF CARDS$(R)="" THEN END 550 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 530 560 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 570 PLAYER$(PERSON,SLOT)=CARDS$(R) 580 CARDS$(R)=CARDS$(R)+"*" 590 NEXT LOADLOOP 600 RETURN 610 !===================print hands 620 HAND$(1)="":HAND$(2)="":HAND$(3)="" 630 FOR PLAYER = 1 TO 3 640 FOR CARDS = 1 TO 5 650 HAND$(PLAYER)=HAND$(PLAYER)+PLAYER$(PLAYER,CARDS)+" " 660 NEXT CARDS 670 NEXT PLAYER 680 PRINT "BRAD ",HAND$(1) 690 PRINT "KFF ",HAND$(2) 700 PRINT "ARTLER ",HAND$(3) 710 RETURN 720 !===================DISCARD ERROR CHECK 730 REENTER=0 740 IF DISCARD$="0" THEN REENTER=0:RETURN 750 IF LEN(DISCARD$)>5 THEN REENTER=1:RETURN 760 FOR CHECKLOOP = 1 TO LEN(DISCARD$) 770 SLOTCHECK=VAL(MID$(DISCARD$,CHECKLOOP,1)) 780 IF SLOTCHECK <1 OR SLOTCHECK > 5 THEN REENTER=1 790 NEXT CHECKLOOP 800 RETURN
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 17, 2023 17:34:29 GMT -8
On a smaller scale, we measure East-West via the Cascade Mountains. As for seasons, we do have those years where fall-winter-spring are almost indistinguishable. When not in the extreme, that's somewhat typical anyway.
The almost guaranteed warm times here are after the first week in July to about the first week in September. But this year we had a gorgeous June and it actually didn't rain on the 4th of July, which is one of our longer-standing traditions. The weather was uncharacteristically warm, clear, and dry.
|
|
|
Post by artraveler on Jul 17, 2023 18:48:01 GMT -8
draw poker program The idiot proofing gets to be even more complicated when access to the code allows the idiots to make changes. Going from five card draw to Texas hold'em or seven card stud would add lines and lines of code in addition to having players come into the game and leave. Don't take this as a challenge in my wayback machine I took two semesters of coding and decided it just wasn't my thing and that was just in basic. The more useful and arcane coding languages I don't have any reason to learn. My only reason for taking it in college was to better understand accounting programs, in that it was useful and did fill in some gaps the I got my MBA. From my admittedly limited knowledge your little program is elegant in its brevity, good work.
|
|
|
Post by artraveler on Jul 17, 2023 19:04:56 GMT -8
I think I-35 is probably as good a demarcation line as any. I do always think of Fort Worth as the West so I-35 makes a sense as far as the DFW area. Although I-35 bends westward as it goes south. I would draw a line at the hill country of east Texas down to Huston. That takes the libs in Austin out of the picture. Everything all the way to Gulf of Mexico is Southern from a line drawn from Dallas North to Ok and east. The rest of Texas is the west. Seems to me that the Texas constitution has or had a provision to split into four states. Not that I'm suggesting that, but the line from I-35 through the hill country to Huston would make sense the rest of the state could split anyway and still be much the same.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 18, 2023 8:30:30 GMT -8
I've been refining the current program so that I can take your credit card numbers and we can start doing this for real. Of course, all information would be secure. Who could or would hack an Atari 800? But seriously, I spent a few hours refining and streamlining the draw poker game. And, you're right, this would be easy enough to extend into Texas hold'em or seven card stud. I will do today's run (no cheating) and show you the refinements: It was one of those times where nobody improved his hand, and Mr. Kung didn't need to. The program now doesn't go through two stages of prompts: 1) Draw or Stand; 2) Select Discards. Now you just throw the discards or hit "S" for stand. And the feedback/error handling has been improved and simplified. Now if you type "1" (and no need to hit return as before and group them all into strings of "125", etc.), your card is immediately highlighted (marked) as a discard. Hitting "return" ends this process and it goes on to the next player. Of course, the next player can see the other guy's cards but I always draw them (for demonstration purposes) as if I hadn't seen the other cards. The next thing to implement (and this could be tricky) is un-marking the cards for discard. If you hit a "1" the first card in your hand is marked. If you hit "1" again, it needs to unmark it (and do some other stuff as well). 10 REM "H2:CARDSDRW10E.MSL" 20 CLEAR 30 RANDOMIZE 40 CLS 50 DIM CARDS$(52),PLAYER$(3,5),HAND$(3),DISCARD$(5) 60 !===================create the deck 70 FOR Y = 1 TO 52 80 READ CARDS$(Y) 90 NEXT Y 100 !==================deal 5 cards each to 3 players 110 FOR GAMER = 1 TO 3 120 FOR X = 1 TO 5 130 R=RND(52) 140 IF CARDS$(R)="" THEN END 150 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 130 160 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 170 PLAYER$(GAMER,X)=CARDS$(R) 180 CARDS$(R)=CARDS$(R)+"*" 190 NEXT X 200 NEXT GAMER 210 GOSUB 730 ! {PRINT HANDS} 220 !===================ask for discards 240 FOR Y = 1 TO 3 250 PRINT AT (2,3+(2*Y)):PRINT "#";Y;": ENTER DISCARDS or (S)TAND: "; 260 OPEN #4,"K:" INPUT 270 GET#4,X 280 IF X=155 OR X=83 THEN GOTO 350 ! RETURN ENDS, S IS FOR STANDS 290 IF X<1+48 OR X>5+48 THEN GOTO 270 291 IF INSTR(DISCARD$,CHRS(X)) THEN PRINT CHR$(253) 300 DISCARD$=DISCARD$+CHR$(X) 310 INVERT$=PLAYER$(Y,X-48) 320 FIRST=128+ASC(MID$(INVERT$,1,1)):SECOND=128+ASC(MID$(INVERT$,2,1)) 330 PRINT AT (13+(3*(X-48)),1+Y);CHR$(FIRST);CHR$(SECOND) 340 GOTO 270 350 CLOSE #4:PRINT AT (2,7); 360 PERSON=Y:GOSUB 610 ! {PROCESS DISCARDS} 370 NEXT Y 380 GOTO 510 ! {PRINT} 510 !===================PRINT FINAL RESULTS 520 PRINT AT (2,12);:GOSUB 730 ! {PRINT HANDS} 530 PRINT:INPUT "PLAY AGAIN? ";ANS2$ 540 IF ANS2$ ="Y" THEN GOTO 20 ELSE END 550 !===================data for deck of cards 560 DATA AH,2H,3H,4H,5H,6H,7H,8H,9H,TH,JH,QH,KH 570 DATA A`,2`,3`,4`,5`,6`,7`,8`,9`,T`,J`,Q`,K` 580 DATA A#,2#,3#,4#,5#,6#,7#,8#,9#,T#,J#,Q#,K# 590 DATA A{,2{,3{,4{,5{,6{,7{,8{,9{,T{,J{,Q{,K{ 600 !===================choose new from discard 610 FOR LOADLOOP = 1 TO LEN(DISCARD$) 620 SLOT=VAL(MID$(DISCARD$,LOADLOOP,1)) 630 R=RND(52) 640 IF CARDS$(R)="" THEN END 650 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 630 660 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 670 PLAYER$(PERSON,SLOT)=CARDS$(R) 680 CARDS$(R)=CARDS$(R)+"*" 690 NEXT LOADLOOP 700 DISCARD$="" 710 RETURN 720 !===================print hands 730 HAND$(1)="":HAND$(2)="":HAND$(3)="" 740 FOR PLAYER = 1 TO 3 750 FOR CARDS = 1 TO 5 760 HAND$(PLAYER)=HAND$(PLAYER)+PLAYER$(PLAYER,CARDS)+" " 770 NEXT CARDS 780 NEXT PLAYER 790 PRINT" 1 2 3 4 5" 800 PRINT" ##############" 810 PRINT "BRAD ",HAND$(1) 820 PRINT "KFF ",HAND$(2) 830 PRINT "ARTLER ",HAND$(3) 840 RETURN I'm not particularly good at it, but I dabble from time to time. There are six or seven main BASIC variants for the Atari 8-bit line of computers. Plus there are one or two languages such as Action! that mimic advanced languages such as C++ (and are apparently screaming fast as well). I've looked at a few of them. And certainly Action! is very powerful and is doable. But the way these more advanced languages operation just doesn't click in my brain. I've been using Microsoft BASIC II for this draw poker program because it has true string arrays and Atari BASIC does not. That makes it hard (for me) to do a program like that without that feature. But the original listing that I posted (done by someone else) uses Atari Basic, so it can certainly be done. And I could probably do it if I tried, especially with that example to work with. But I wanted to work in Microsoft BASIC II. I had purchased this way back when (for how much, I don't remember, but it wasn't trivial). I used it some but not all that much I think the best language for just dabbling (or even more serious stuff) is Turbo-Basic XL. That's what I'm using for most of the little programs I'm trying out. It's backward compatible with Atari Basic but adds some structured programming functions that aid in writing good, readable code including: REPEAT/UNTIL WHILE/WEND IF/ELSE/ENDIF DO/LOOP PROC/END PROCEDURE (for procedures, proper) Plus it has the extremely useful function of being able to read disk directories without leaving the program and exiting into DOS, as most other languages require. Turbo-BASIC XL is also about five times faster than Atari Basic. And you can also take the extra step of compiling the programs if you want and that can make them up to 10 times faster. And these compiled programs can be run as stand-alone programs. So I'm really enamored with this language...but it's still a shame that, like Atari Basic, it has no true string arrays. Strings (all language variants) hold alphanumeric data as "text" not as numbers. The difference between the two string capabilities is: Atari Basic: DIM Test$(20) : This "dimensions" or initializes a string called "Test$" with a length of 20. That is, it can hold up to twenty characters. So you could go: Test$ = "Donald J. Trump". And if you asked the computer to: Print Test$ you would get Donald J. Trump. That sounds all well and good but lacks the power of how string arrays work in every other language: In Microsoft Basic the initialization is the same: DIM Test$(20). But now lets put some stuff in it. That is not the same "twenty character slots" of Atari Basic which can only hold up to 20 characters total. In the Microsoft BASIC version, each of those 20 slots itself can hold (I forget the limit...maybe 255) a bunch of characters. So we could have: Test$(1)="Donald":Test$(2)=" J. ":Test$(3)="Trump". [up to Test$(20) if we wanted]. Now we tell it to: Print Test$(1);Test$(2);Test(3). (the semicolons cause these items to print right after each other on the same line). And you get: Donald J. Trump. And this feature makes it way easier to construct a deck of cards, let alone be able to manipulate them later. At least for me.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 18, 2023 10:32:17 GMT -8
And that final "deselect discard" function has been added successfully, so we'll call it good. Therefore this next one (everyone kicks in fifty bucks) is the Grand Prize. I will run it next, no cheating. And if KFF gets three of a kind again, I'm going to have to double-check that randomizing function: KFF wins again, even after I made a mistake in the discards. Perhaps I was just subconsciously refusing to believe he had another three-of-a-kind. But it's kind of hard to call him for cheating. 10 REM "H2:CARDSDRW10E.MSL" 20 CLEAR 30 RANDOMIZE 40 CLS 50 DIM CARDS$(52),PLAYER$(3,5),HAND$(3),DISCARD$(5) 60 !===================create the deck 70 FOR Y = 1 TO 52 80 READ CARDS$(Y) 90 NEXT Y 100 !==================deal 5 cards each to 3 players 110 FOR GAMER = 1 TO 3 120 FOR X = 1 TO 5 130 R=RND(52) 140 IF CARDS$(R)="" THEN END 150 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 130 160 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 170 PLAYER$(GAMER,X)=CARDS$(R) 180 CARDS$(R)=CARDS$(R)+"*" 190 NEXT X 200 NEXT GAMER 210 GOSUB 730 ! {PRINT HANDS} 220 !===================ask for discards 240 FOR Y = 1 TO 3 250 PRINT AT (2,3+(2*Y)):PRINT "#";Y;": ENTER DISCARDS or (S)TAND: "; 260 OPEN #4,"K:" INPUT 270 GET#4,X 280 IF X=155 OR X=83 THEN GOTO 350 ! RETURN ENDS, S IS FOR STANDS 290 IF X<1+48 OR X>5+48 THEN GOTO 270 291 IF INSTR(DISCARD$,CHR$(X)) THEN GOSUB 900:GOTO 270 300 DISCARD$=DISCARD$+CHR$(X) 310 INVERT$=PLAYER$(Y,X-48) 320 FIRST=128+ASC(MID$(INVERT$,1,1)):SECOND=128+ASC(MID$(INVERT$,2,1)) 330 PRINT AT (13+(3*(X-48)),1+Y);CHR$(FIRST);CHR$(SECOND) 340 GOTO 270 350 CLOSE #4:PRINT AT (2,7); 360 PERSON=Y:GOSUB 610 ! {PROCESS DISCARDS} 370 NEXT Y 380 GOTO 510 ! {PRINT} 510 !===================PRINT FINAL RESULTS 520 PRINT AT (2,12);:GOSUB 730 ! {PRINT HANDS} 530 PRINT:INPUT "PLAY AGAIN? ";ANS2$ 540 IF ANS2$ ="Y" THEN GOTO 20 ELSE END 550 !===================data for deck of cards 560 DATA AH,2H,3H,4H,5H,6H,7H,8H,9H,TH,JH,QH,KH 570 DATA A`,2`,3`,4`,5`,6`,7`,8`,9`,T`,J`,Q`,K` 580 DATA A#,2#,3#,4#,5#,6#,7#,8#,9#,T#,J#,Q#,K# 590 DATA A{,2{,3{,4{,5{,6{,7{,8{,9{,T{,J{,Q{,K{ 600 !===================choose new from discard 610 FOR LOADLOOP = 1 TO LEN(DISCARD$) 620 SLOT=VAL(MID$(DISCARD$,LOADLOOP,1)) 630 R=RND(52) 640 IF CARDS$(R)="" THEN END 650 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 630 660 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 670 PLAYER$(PERSON,SLOT)=CARDS$(R) 680 CARDS$(R)=CARDS$(R)+"*" 690 NEXT LOADLOOP 700 DISCARD$="" 710 RETURN 720 !===================print hands 730 HAND$(1)="":HAND$(2)="":HAND$(3)="" 740 FOR PLAYER = 1 TO 3 750 FOR CARDS = 1 TO 5 760 HAND$(PLAYER)=HAND$(PLAYER)+PLAYER$(PLAYER,CARDS)+" " 770 NEXT CARDS 780 NEXT PLAYER 790 PRINT" 1 2 3 4 5" 800 PRINT" ##############" 810 PRINT "BRAD ",HAND$(1) 820 PRINT "KFF ",HAND$(2) 830 PRINT "ARTLER ",HAND$(3) 840 RETURN 900 !===================deselect discard 905 !-------------------revert previous discard 910 LOC=INSTR(DISCARD$,CHR$(X)) 920 REVERT$=PLAYER$(Y,X-48) 930 FIRST=ASC(MID$(REVERT$,1,1)):SECOND=ASC(MID$(REVERT$,2,1)) 940 PRINT AT (13+(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
|
|
|
Post by kungfuzu on Jul 18, 2023 10:58:35 GMT -8
Can you doubt that this comes from my superior poker skills.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 18, 2023 16:29:01 GMT -8
Okay, I'll play one right now for the championship of the day. If you get 3-of-a-kind again, we'll know something is rotten In Denmark...or Dallas. Here goes... Well, at least you didn't hit the full house. I thought about going for an inside straight draw for Artler. But seeing (as the all-seeing eye can) so many 3s already in play, I went another route.
|
|
|
Post by kungfuzu on Jul 18, 2023 16:51:52 GMT -8
OK. Let it ride.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 21, 2023 8:52:58 GMT -8
Okay. Artler may be rolling his eyes at this, but I've added another trick that this pony can do. This will be the first official public run. No ginning of the results has occurred. Everyone ante $10.00. Don't mind that the hand evaluation overprinted one of Artler's cards. Can I help it if he got a 3-of-a-kind right off the bat? I need to truncate the label to "3" instead of printing out "Three." But that is mere cosmetics and very easy to fix. But the hard part was evaluating the poker hand. I won't tell you how many hours I worked on this off and on. You've seen the main part of the code. The following is just the subroutine for evaluating a five-card poker hand: 2000 ! =====================HAND EVALUATOR 2020 SFLAG=0:PAIR=0:THREE=0:FOUR=0:VALUE=0 2030 : FOR I = 1 TO 14:COUNT(I)=0:NEXT I 2040 LET DECK$ = "2 3 4 5 6 7 8 9 T J Q K A" 2050 LET SUIT$ = "H C D S" 2060 ! LET HAND$ = A$ + " " + B$ + " " + C$ + " " + D$ + " " + E$ 2070 LET HAND$ = HANK$(PLAYLOOP) 2075 ! LET HAND$ = "8D 7S TH 9H 6S" 2090 FOR I = 1 TO 5 2100 LET CARD$ = MID$(HAND$,I * 3-2,2) 2110 LET RANK$ = LEFT$(CARD$,LEN(CARD$)-1) 2120 LET VALUE = (INSTR(DECK$,RANK$)+1)/2+1 2130 LET COUNT(VALUE) = COUNT(VALUE) + 1 2140 NEXT I 2150 LET PAIR = 0 2160 LET THREE = 0 2170 FOR I = 1 TO 14 2180 IF COUNT(I) = 2 THEN LET PAIR = PAIR + 1 2190 IF COUNT(I) = 3 THEN LET THREE = THREE + 1 2200 IF COUNT(I) = 4 THEN LET FOUR = FOUR + 1 2210 NEXT I 2220 IF FOUR = 1 THEN LET HANDTYPE$ = "Four of a Kind":GOTO 2500 2230 IF PAIR = 1 AND THREE = 1 THEN LET HANDTYPE$ = "Full House":GOTO 2500 2240 ! +++++++++++++++++++++STRAIGHT? 2250 GOSUB 2340 ! {sraight eval} 2260 IF HANDTYPE$ = "Straight" THEN SFLAG=1 2270 ! +++++++++++++++++++++FLUSH? 2280 GOSUB 2510: IF HANDTYPE$ = "Flush" THEN GOTO 2500 2290 IF THREE = 1 THEN LET HANDTYPE$ = "Three of a Kind":GOTO 2500 2300 IF PAIR = 2 THEN LET HANDTYPE$ = "Two Pair":GOTO 2500 2310 IF PAIR = 1 THEN LET HANDTYPE$ = "One Pair":GOTO 2500 2320 IF PAIR = 0 AND THREE = 0 THEN LET HANDTYPE$ = "High Card" 2330 GOTO 2500 2340 ! =====================STRAIGHT EVAL 2350 ! DIM C(5) 2360 FOR I = 1 TO 5 2370 LET CARD$ = MID$(HAND$,I * 3-2,2) 2380 LET RANK$ = LEFT$(CARD$,LEN(CARD$)-1) 2390 LET VALUE = (INSTR(DECK$,RANK$)+1)/2+1 2400 LET C(I)=VALUE 2410 NEXT I 2420 FOR I = 1 TO 4 2430 FOR J=I+1 TO 5 2440 IF C(I)>C(J) THEN T=C(I):C(I)=C(J):C(J)=T 2450 NEXT J 2460 NEXT I 2470 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 LET HANDTYPE$ = "Straight" 2480 RETURN 2490 IF INSTR(HAND$, "AH") AND INSTR(HAND$, "KH") AND INSTR(HAND$, "QH") AND INSTR(HAND$, "JH") AND INSTR(HAND$, "10H") THEN LET HANDTYPE$ = "Royal Flush" 2500 RETURN ! PRINT "Your hand is: "; HANDTYPE$: END 2510 ! =====================FLUSH EVAL 2520 FLUSH$="":COMPARE$="" 2530 LET CARD$ = MID$(HAND$,1,2) 2540 LET SUTE$(1) = MID$(CARD$,2,1) 2550 LET COMPARE$=SUTE$(1) 2560 FOR I = 2 TO 5 2570 LET CARD$ = MID$(HAND$, I * 3 - 2, 2) 2580 LET SUTE$(I) = MID$(CARD$,2,1) 2590 LET COMPARE$=SUTE$(I) 2600 IF SUTE$(I-1)<>COMPARE$ THEN FLUSH$ = "NO" 2610 NEXT I 2620 IF FLUSH$<>"NO" THEN LET HANDTYPE$ = "Flush" 2630 IF FLUSH$<>"NO" AND SFLAG=1 THEN HANDTYPE$ = "Straight Flush": GOTO 2500 2640 IF SFLAG=1 THEN HANDTYPE$="Straight":GOTO 526 2650 RETURN Here's the interesting bit (with "interesting" being a relative term): I used Chat GPT, the online AI thing which is The Next Big Thing. I know that sounds a bit like cheating. And it did give me a head start. But after about 10 permutations with the AI chatbot trying to get it to write something useful, I had to give up and try to use parts of what it gave me. It was funny because much of the code it gave me was brilliant. But there were also entire sections of code that were analogous to "Junk DNA." They did nothing. Once I figured out what they did (which was nothing), I could delete them. And so-called "Junk DNA," on the other hand, as least has been found to code for all kinds of things. But the AI was of some help. I not only didn't want to start from scratch but I wanted to see how far AI had come. And, frankly, I could not find even one example of BASIC code online that I could reference, although there is a ton of code written in other languages – none of which I could make much sense of.
Well, it's amazing that the AI can do what it can do. But I wouldn't trust it to even turn a door knob for me. At this point you can take the output as a suggestion. Instead of "ChatGPT" it should be "ChatGrain-of-Salt." Looking back – except for the routine for evaluating a straight – I likely could have done this faster starting from scratch. It took a while to figure out what it was doing. And there were many errors (aside for the "Junk DNA") embedded in the code – yuge logical errors. But I learned something. It had offered no routine for evaluating a flush, so I was able to write my own, having been schooled (with help from Grain-of-Salt) in the basic approaches. Now I suppose what is left to do is not just evaluate the individual hands but to evaluate them against each other and call a "Winner, winner, chicken dinner," as they say.
|
|
|
Post by artraveler on Jul 21, 2023 9:33:42 GMT -8
Artler may be rolling his eyes at this
Eye Roll It is interesting that AI was able to develop an evaluation code, even with extraneous bits. A person paranoid about AI would have reason to load up the bomb shelter waiting for the terminators. We are a long way away from that but sometime in the next 25 years or so AI may be writing code it is not told to write, that could be a new dawn for civilization or the end. Not likely any of us will be around to see it.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Jul 21, 2023 9:47:58 GMT -8
I kid you not. This was the very next hand: And the one after that, Artler got a full house (and KFF had 3-of-a-kind). He should go buy a lottery ticket.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Aug 4, 2023 14:53:31 GMT -8
I think half the art of programming – if not three-quarters – is not getting lost in a maze.
Using the BASIC programming language is very beneficial for casual users because it's easy to get into. You can get something done right away without a lot of gobbledygook setup.
The downside is that it's a language that generally is "unstructured." And that means it's very easy to write "spaghetti" code. That's the kind of code that jumps over here, and then there, and it becomes hard to follow, let alone hard to find your errors.
Well, in putting this poker beast together, I boiled a lot of spaghetti. And that would have been fine. But I ran into a couple of things (rare occurrences) that weren't working right. It would analyze straights correctly, but for some reason I got a "next without a for" error when it found straight and the error would halt the program. That error meant that I was entering and re-entering a "for/next" loop more time than I shouldn’t, a sure sign of spaghetti.
Try as I might, I couldn't find the error. But that's the nature of spaghetti programming. It can be hard to follow. I tried fudging it here and there, thinking the some minor fix would do the trick. But nothing worked.
So I set forth to cleaning it up. And, miracle of miracles, I succeeded. Having cleaned up all my "GOSUB" routines and "RETURNS" and all other forms of pasta-making, damned if it didn't work after the first overhaul. I mean, this really did surprise the hell out of me. I changed quite a few things and expected that I would have missed something or broken something in the midst of trying to fix something else.
This is why "gene therapy" is probably a long way off to doing anything useful. Not that the Intelligent Designer uses spaghetti code. Far from it. But the code and mechanisms are so complex and interwoven – and the miniature scale imposes its own difficulties – that it could be several decades or centuries before we have a basic grasp on how it all works.
You hear about the Human Genome Project sequencing human DNA. This is useful and certainly a lot of advances have been made because of a basic understanding of genetics. But this "Human Genome Project" is an illusion like much of the "big science" stuff being bandied about.
The backer of all this would have you believe that we've accomplished something major. If this were true, instead of mutilating children via surgery we could just give them a pill and they would grow a dick, or whatever. But the systems are so complex, I would consider the data in the Human Genome Project to be about as useful as knowing all the telephone numbers of all residents in the State of New York. It's data, It has some moderate utility. But it's mostly just piles of data on not much practical use…especially if the telephone and the phone line infrastructure had yet to be invented and installed.
So having a sequence of all the four nucleotide bases that make up human DNA is about as useful as knowing all the telephone number in New York...before the phone had been invented. These are just numbers without much context because no one really understand the machine as a whole. We are beginning to understand in detail part of it here and there. But the sheer enormity of the complexity, as well as the vastness of the systems, leaves ample room for discovery, if not sheer awe. And to believe this all occurred by chance, in my not-so-humble opinion, marks one as a fool or a religious zealot.
To deal even in BASIC is to have some understanding, no matter how small, of the truly miraculous enormity of how life is composed, constructed, and operates.
Here's the cleaned-up code. And, yes, to a professional programmer this is still going to look like spaghetti.
10 LIST "H2:CARDSDRW11J.MSL" 15 POKE 710,128:POKE 712,128:POKE 709,14 ! {background,border,and text colors] 20 CLEAR 30 RANDOMIZE 40 CLS 50 DIM CARDS$(52),PLAYER$(3,5),HANK$(3),DISCARD$(5) 55 DIM DECKS(30),HAND$(30),SUTE$(5),FLUSH$(5),COMPARE$(10),COUNT(14),C(5),PLAYLOOP(3) 60 !===================create the deck 70 FOR Y = 1 TO 52 80 READ CARDS$(Y) 90 NEXT Y 100 !==================deal 5 cards each to 3 players 110 FOR GAMER = 1 TO 3 120 FOR X = 1 TO 5 130 R=RND(52) 140 IF CARDS$(R)="" THEN END 150 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 130 160 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 170 PLAYER$(GAMER,X)=CARDS$(R) 180 CARDS$(R)=CARDS$(R)+"*" 190 NEXT X 200 NEXT GAMER 210 GOSUB 730 ! {PRINT HANDS} 220 !===================ask for discards 240 FOR Y = 1 TO 3 245 PRINT AT (21,1+Y);">" 250 PRINT AT (2,3+(2*Y)):PRINT "#";Y;": ENTER DISCARDS or (S)TAND: "; 260 OPEN #4,"K:" INPUT 270 GET#4,X 280 IF X=155 OR X=83 THEN GOTO 350: RETURN ENDS, S IS FOR STANDS 290 IF X<1+48 OR X>5+48 THEN GOTO 270 291 IF INSTR(DISCARD$,CHR$(X)) THEN GOSUB 900:GOTO 270 300 DISCARD$=DISCARD$+CHR$(X) 310 INVERT$=PLAYER$(Y,X-48) 320 FIRST=128+ASC(MID$(INVERT$,1,1)):SECOND=128+ASC(MID$(INVERT$,2,1)) 330 PRINT AT (19+(3*(X-48)),1+Y);CHR$(FIRST);CHR$(SECOND) 340 GOTO 270 350 CLOSE #4:PRINT AT (2,7); 360 PERSON=Y:GOSUB 610 ! {PROCESS DISCARDS} 365 PRINT AT (21,1+Y);" " 370 NEXT Y 380 GOTO 510 ! {PRINT} 510 !===================PRINT FINAL RESULTS 515 PRINT AT (2,12);:GOSUB 730 ! {PRINT HANDS} 520 FOR PLAYLOOP = 1 TO 3 521 HANDTYPE$="" 525 GOSUB 2000 ! {RANK HAND} 526 PRINT AT (9,13+PLAYLOOP);HANDTYPE$ 527 NEXT PLAYLOOP 528 PRINT AT (2,19);"PLAY AGAIN?...(N) to exit" 529 OPEN #4,"K:" INPUT 530 GET#4,X 535 IF X=78 THEN END ELSE CLOSE #4: GOTO 20! "N" ENDS, ANY OTHER KEY PLAYS AGAIN 550 !===================data for deck of cards 560 DATA AH,2H,3H,4H,5H,6H,7H,8H,9H,TH,JH,QH,KH 570 DATA A`,2`,3`,4`,5`,6`,7`,8`,9`,T`,J`,Q`,K` 580 DATA A#,2#,3#,4#,5#,6#,7#,8#,9#,T#,J#,Q#,K# 590 DATA A{,2{,3{,4{,5{,6{,7{,8{,9{,T{,J{,Q{,K{ 600 !===================choose new from discard 610 FOR LOADLOOP = 1 TO LEN(DISCARD$) 620 SLOT=VAL(MID$(DISCARD$,LOADLOOP,1)) 630 R=RND(52) 640 IF CARDS$(R)="" THEN END 650 IF MID$(CARDS$(R),3,1)="*" THEN GOTO 630 660 IF MID$(CARDS$(R),2,1)="H" THEN CARDS$(R)=MID$(CARDS$(R),1,1)+CHR$(0) 670 PLAYER$(PERSON,SLOT)=CARDS$(R) 680 CARDS$(R)=CARDS$(R)+"*" 690 NEXT LOADLOOP 700 DISCARD$="" 710 RETURN 720 !===================print hands 730 HANK$(1)="":HANK$(2)="":HANK$(3)="" 740 FOR PLAYER = 1 TO 3 750 FOR CARDS = 1 TO 5 760 HANK$(PLAYER)=HANK$(PLAYER)+PLAYER$(PLAYER,CARDS)+" " 770 NEXT CARDS 780 NEXT PLAYER 790 PRINT" 1 2 3 4 5" 800 PRINT" ##############" 810 PRINT "BRAD "," ";HANK$(1) 820 PRINT "KFF "," ";HANK$(2) 830 PRINT "ARTLER "," ";HANK$(3) 840 RETURN 900 !===================deselect discard 905 !-------------------revert previous discard 910 LOC=INSTR(DISCARD$,CHR$(X)) 920 REVERT$=PLAYER$(Y,X-48) 930 FIRST=ASC(MID$(REVERT$,1,1)):SECOND=ASC(MID$(REVERT$,2,1)) 940 PRINT AT (19+(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 980 ! 990 ! 1000 ! 2000 ! =====================HAND EVALUATOR 2020 SFLAG=0:PAIR=0:THREE=0:FOUR=0:VALUE=0 2030 : FOR I = 1 TO 14:COUNT(I)=0:NEXT I 2040 LET DECK$ = "2 3 4 5 6 7 8 9 T J Q K A" 2050 LET SUIT$ = "H C D S" 2070 LET HAND$ = HANK$(PLAYLOOP) 2090 FOR I = 1 TO 5 2100 LET CARD$ = MID$(HAND$,I * 3-2,2) 2110 LET RANK$ = LEFT$(CARD$,LEN(CARD$)-1) 2120 LET VALUE = (INSTR(DECK$,RANK$)+1)/2+1 2130 LET COUNT(VALUE) = COUNT(VALUE) + 1 2140 NEXT I 2150 LET PAIR = 0 2160 LET THREE = 0 2170 FOR I = 1 TO 14 2180 IF COUNT(I) = 2 THEN LET PAIR = PAIR + 1 2190 IF COUNT(I) = 3 THEN LET THREE = THREE + 1 2200 IF COUNT(I) = 4 THEN LET FOUR = FOUR + 1 2210 NEXT I 2215 ! ++++++++++++++++++++++++++++++++++ 2220 IF FOUR = 1 THEN LET HANDTYPE$ = "4 of a Kind": RETURN ! (Returns to line 526) 2230 IF PAIR = 1 AND THREE = 1 THEN LET HANDTYPE$ = "Full House": RETURN ! (Returns to line 526) 2240 ! +++++++++++++++++++++++++STRAIGHT? 2250 GOSUB 2340 ! {sraight eval} 2260 IF HANDTYPE$ = "Straight" THEN SFLAG=1 2270 ! ++++++++++++++++++++++++++++FLUSH? 2280 GOSUB 2510 2281 IF HANDTYPE$ = "Flush" THEN RETURN ! (Returns to line 526) 2282 IF HANDTYPE$ = "Straight" THEN RETURN ! (Returns to line 526) 2283 IF HANDTYPE$ = "Straight Flush" THEN RETURN ! (Returns to line 526) 2285 ! ++++++++++++++++++++++++++++++++++ 2290 IF THREE = 1 THEN LET HANDTYPE$ = "3 of a Kind": RETURN ! (Returns to line 526) 2300 IF PAIR = 2 THEN LET HANDTYPE$ = "Two Pair": RETURN ! (Returns to line 526) 2310 IF PAIR = 1 THEN LET HANDTYPE$ = "One Pair": RETURN ! (Returns to line 526) 2320 IF PAIR = 0 AND THREE = 0 THEN LET HANDTYPE$ = "High Card": RETURN ! (Returns to line 526) 2340 ! =====================STRAIGHT EVAL 2350 ! DIM C(5) 2360 FOR I = 1 TO 5 2370 LET CARD$ = MID$(HAND$,I * 3-2,2) 2380 LET RANK$ = LEFT$(CARD$,LEN(CARD$)-1) 2390 LET VALUE = (INSTR(DECK$,RANK$)+1)/2+1 2400 LET C(I)=VALUE 2410 NEXT I 2420 FOR I = 1 TO 4 2430 FOR J=I+1 TO 5 2440 IF C(I)>C(J) THEN T=C(I):C(I)=C(J):C(J)=T 2450 NEXT J 2460 NEXT I 2470 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 LET HANDTYPE$ = "Straight" 2480 RETURN 2510 ! ======================FLUSH EVAL 2520 FLUSH$="":COMPARE$="" 2530 LET CARD$ = MID$(HAND$,1,2) 2540 LET SUTE$(1) = MID$(CARD$,2,1) 2550 LET COMPARE$=SUTE$(1) 2560 FOR I = 2 TO 5 2570 LET CARD$ = MID$(HAND$, I * 3 - 2, 2) 2580 LET SUTE$(I) = MID$(CARD$,2,1) 2590 LET COMPARE$=SUTE$(I) 2600 IF SUTE$(I-1)<>COMPARE$ THEN FLUSH$ = "NO" 2610 NEXT I 2620 IF FLUSH$<>"NO" THEN LET HANDTYPE$ = "Flush" 2630 IF FLUSH$<>"NO" AND SFLAG=1 THEN HANDTYPE$ = "Straight Flush" 2640 ! IF HANDTYPE$ <> "Straight Flush" AND SFLAG=1 THEN HANDTYPE$="Straight" 2650 RETURN
|
|
|
Post by kungfuzu on Aug 4, 2023 15:13:07 GMT -8
I would say, "That's Greek to me," but that would be giving myself too much credit.
|
|
|
Post by kungfuzu on Aug 4, 2023 15:35:25 GMT -8
When we found out our son had Fragile X Syndrome, back in 1995, we started looking into the condition very closely and what possible cures there might be. There were, of course, none. Yet, even then people were discussing the possibility of developing gene therapies. I suppose this hope was, in large part, due to the fact that the Human Genome Project had started in 1990 and appeared to be making good progress.
Even before the completion of the Project, i.e. sometime around 1997, many dealing with Fragile X, had hopes that there might be a cure by around 2015. One basis for this optimism was the fact that Fragile X is caused by one faulty gene which does not produce a necessary protein. This problem is orders-of-magnitude less complicated than something like Down Syndrome.
Once the Genome Project was completed in 2003, everyone was surprised by the number of human genes which was something around 20-30,000, as I recall. They had believed there would be many more. What became clear was that the role of proteins played a much more complicated part than scientists had imagined. Thus "fixing" a problem was going to be more complicated than they thought. Since 2003, they have figured out that there are, in fact, more genes than they originally thought. Another sign of the complexity of the problem.
We are now in 2023 and there is no genetic therapy on the horizon, that I know of. There are even no drug therapies which are truly promising.
In the meantime, millions have been spent, and much has been learned, but there does not appear to be any "magic bullet" in view. Our son will be thirty in a few months and we're are still hopeful. But then the question arises, "If a cure is found, how will that effect him socially?" He has no friends, no family except us and has difficulty interacting with people most of the time. He has only a rudimentary education and it would take some years for him to try and catch up. How would he adapt once we die? Would he be a ward of the state, would they help him or would they wash their hands of him because he suddenly had a higher IQ?
These and many other things are what we have to consider.
|
|
Brad Nelson
Administrator
עַבְדְּךָ֔ אֶת־ הַתְּשׁוּעָ֥ה הַגְּדֹלָ֖ה הַזֹּ֑את
Posts: 12,261
|
Post by Brad Nelson on Aug 4, 2023 16:20:16 GMT -8
Of course our thoughts are always for the health and happiness of Flu Jr. In some ways, from what you have described to me, we're not all that different in kind, just in degree. I think my "Fragile X" problem was having a nasty older brother. He's tame now, but still a flake. Did I say that out loud? Okay, it's frivolous to say "It will all work out." But something tells me that it will. It's certainly possible that effective treatment will be forthcoming. It chafes my butt that even one dime is spent by the medical profession on mutilating kids when every ounce of time and money should go to curing those with real (not imagined) problems. It's also frivolous to say "In this world, Flu Jr. is the sane one." That's because I have some idea of the time and effort that the parents of such children put in. Yes, these kids are special, perhaps the proverbial "Children of a Lesser God." They are miracles in their own right. That said, if God looks after his children, he's got a special eye on Flu Jr. The real solution is to dump your mind inside a robot so that you live forever...or at least much longer. Join the transhuman movement. After all, what could go wrong? By the way, is this the correct place to make a small donation? I feel like doing so.
|
|