----------------------------
FIVE CARD DRAW VIDEO POKER
----------------------------
by Adrian Mettler
http://www.zapcom.net/~kazmet/a
kazmet@zapcom.net
(Six programs, total 863 bytes)
This is a text based five-card-draw video poker game for the TI-81, based
on POKER1.4 (author unknown). Points are gained for hands higher than one
pair, and lost for hands lower than one pair.
GOODIES:
•Real hand creation and draw
•Variable bet
•Standard poker hands, from pair to royal flush
•No weird fake hands (no two of the same card)
•Two playing modes -- individual-game or continuously accumulative score
•No bugs (I hope- PLEASE notify me of any bugs or typos)
CAVEATS (BAD STUFF):
•The graphics suck (they're text)
•Dealing and hand appraisal are a little slow on a TI-81
•Requires six program slots on calculator
GAMEPLAY:
When the game starts up, your score is shown and a bet is prompted for.
Enter your bet to see your cards, or 0 to quit. Your hand should look
something like this:
4E12
3E1
2E11
4E11
1E3
0=HOLD 1=DROP =
1
?
Yes, this really is your hand. (I warned you that the graphics sucked.)
The five pairs of numbers separated by E's are your five cards. The number
before the "E" is the suit of each card: 1 is spades, 2 is hearts, 3 is
diamonds, and 4 is clubs. The number after the "E" is its rank. 1's are
aces, 13's are kings, 12's are queens, 11's are jacks, and 2's through 10's
are deuces through tens.
The number one at the bottom right is the number of the current card to hold
or to drop and replace with another. Press 0 to keep or 1 to drop the
numbered card, and Enter to go to the next card. For example, I would hit
"1, Enter, 1, Enter, 0, Enter, 0, Enter, 1, Enter" to keep the pair of jacks
and get rid of the rest.
Then you might see:
3E5
1E9
2E11
4E11
4E5
2 PAIR
100
(if you had bet 100 chips)
The 7th line tells you what your hand was (pair, straight, etc.) and the 8th
line says how much money you won (or lost if it's a negative number).
Press enter and play another hand or quit.
PROGRAMMING NOTES:
The program slots used here are only examples. I recommend you use an
easily executable slot (1-6 or so) for VIDPOKER and slots V-Z for the other
five subroutine programs. In the example, I've simply used 1-6. (On my
calculator it's Prgm8 and T-X -- oh well.)
The code following is for cumulative-score mode. In this mode, your score
is retained and added to forever, or until you go bankrupt and it resets to
1000. One variable on your calculator (denoted as @ in this example) has
to NEVER BE USED except in this program, or your score will be altered.
In individual-game mode, whenever you quit and restart the program you start
out again with 1000 chips. The code for this mode differs slightly from the
one shown below. Simply omit the second-to-the last line of Prgm3:POKRINF2,
"1000 -> @" and add this as the first line of Prgm1:VIDPOKER.
Because the program uses the statistics functions of the calculator, about
80 bytes of free memory is needed to run it in addition to the 863 bytes
needed to store the program code.
If you're tight on memory, you can remove the "FIVE CARD DRAW VIDEO POKER"
banner and trim down the bankrupt announcement, saving 60 bytes or so.
---------begin program code---------
Prgm1:VIDPOKER (572 bytes)
:Lbl 1
:ClrStat
:Prgm2 (Use the number or letter for POKRINF1 here, 2=example)
:1 -> P (-> is the [STO>] key. Do not put spaces around it.)
:Prgm5 (Use the number or letter for POKRDAT2 here,)
:Prgm6 (and for POKRDAT3 here, etc.)
:1 -> V
:Lbl J
:Prgm4 (POKRDAT1)
:Disp "0=HOLD 1=DROP ="
:Disp V
:Input {y}(V
:IS>(V,5
:Goto J
:Prgm6 (POKRDAT3)
:Prgm4 (POKRDAT1)
:1 -> R
:Lbl R
:0 -> V
:Lbl M
:V+1 -> V
:{x}(R)/10^V -> L
:If L>9
:Goto M
:L -> {y}(R
:V -> {x}(R
:IS>(R,5
:Goto R
:xSort
:{x}(1 -> A
:{x}(2 -> B
:{x}(3 -> C
:{x}(4 -> D
:{x}(5 -> E
:({y}(1)={y}(2))+({y}(3)={y}(4))+({y}(1)={y}(3))+({y}(1)={y}(5 -> F
:If (B[not equal to sign]C-1)+(C[not equal to]D-1)+(D[not equal to]E-1
:Goto 2
:If (A[not equal to]B-1)((A[not equal to]1)+(E[not equal to]13
:Goto 2
:Disp "STRAIGHT"
:8 -> W
:If F[not equal to]4
:Goto Z
:Disp "FLUSH"
:70 -> W
:If B[less than or equal to]9
:Goto Z
:Disp "ROYAL"
:100 -> W
:Goto Z
:Lbl 2
:(A=B)+(B=C)+(C=D)+(D=E -> V
:If V=1
:Goto 3
:If V=2
:Goto 5
:If F=4
:Goto 6
:If V=3
:Goto 8
:Disp "YOU LOSE"
:-1 -> W
:Goto Z
:Lbl 8
:If (B=C)(C=D
:Goto 7
:Disp "FULL HOUSE"
:25 -> W
:Goto Z
:Lbl 7
:50 -> W
:Disp "4 OF A KIND"
:Goto Z
:Lbl 6
:Disp "FLUSH"
:10 -> W
:Goto Z
:Lbl 5
:If (A=C)+(B=D)+(C=E
:Goto 4
:Disp "2 PAIR"
:1 -> W
:Goto Z
:Lbl 4
:Disp "3 OF A KIND"
:5 -> W
:Goto Z
:Lbl 3
:Disp "PAIR"
:0 -> W
:Lbl Z
:MW -> M
:Disp M
:@+M -> @
:Pause
:Goto 1
Prgm2:POKRINF1 (110 bytes)
:Lbl A
:ClrHome
:Disp " FIVE CARD DRAW "
:Disp " VIDEO POKER "
:If @<-99 ("If @ is less than negative 99")
:Prgm3 (POKRINF2)
:Disp "MONEY="
:Disp @
:Disp "BET? 0=QUIT"
:Input M
:If M=0
:Stop
:Int abs M -> M
:If M-100>@
:Goto A
Prgm3:POKRINF2 (45 bytes)
:Disp ""
:Disp " BANKRUPT"
:Disp " GAME OVER"
:1000 -> @
:Stop
Prgm4:POKRDAT1 (24 bytes)
:ClrHome
:Sci
:1 -> P
:Lbl P
:Disp {x}(P
:IS>(P,5
:Goto P
:Norm
Prgm5:POKRDAT2 (19 bytes)
:1 -> Q
:Lbl Q
:P -> {y}(Q
:IS>(Q,5
:Goto Q
Prgm6:POKRDAT3 (93 bytes)
:Lbl 1
:1 -> P
:Lbl P
:If 1={y}(P
:(Int Rand4+1)10^(Int Rand13+1 -> {x}(P
:IS>(P,5
:Goto P
:1 -> X
:Lbl X
:1 -> Y
:Lbl Y
:If (X[not equals to]Y)({x}(X)={x}(Y
:Goto 1
:IS>(Y,5
:Goto Y
:IS>(X,5
:Goto X
:0 -> P
----------end program code (863 bytes)----------