Post Reply 
(11C) Blackjack - 21
07-08-2019, 05:22 AM (This post was last modified: 07-21-2019 03:05 AM by Gamo.)
Post: #1
(11C) Blackjack - 21
Blackjack or 21 card game is adapted and added more features
from the HP-19C Games Solutions Handbook.

This is not a perfect program anyone got better idea go ahead and make
any suggestion is very welcome.

------------------------------------
Procedure: USER mode

[A] Player
[B] Dealer // Run and make decision automatically
[C] Ace // Player select to use 11 instead of 1
[D] Bankroll
[E] Bet

1. Input specific Bankroll [D]
2. Input your bet [E]
3. Take Cards [A] display first card amount
[R/S] display second card added from 1st card
continue [R/S] until the highest possible you like.
If you win your bankroll is added and display as negative sign -xxx.
4. [B] Dealer play automatically (if Dealer win you bankroll is deducted)

To continue: enter Bet [E] ---> [A] --->[R/S]..... ---->[B] display Bankroll remaining amount as negative value.

-----------------------------------------------
Remark:
Only the player have a choice to pick Ace as 1 or 11
when display show 1 and you want 11 simply press [C]
If you already got 10 next card is Ace press [C] for 11 total is 21
If you got Ace and any other but not 10 then keep on continue with [R/S] to your desire amount then [B]

Even if player done with lower amount for example: 16 if Dealer draw to 16 the dealer will not continue but
stop and get a tie game instead.
Tie Game will shown short moment effect display 0.000000000 then Bankroll amount.
-----------------------------------------------
Program:
Code:

LBL A  // Player
GSB 0  // Get Card
1,1  // the [ , ] mark is a decimal sign 
X<>Y
X>Y
GTO 3
R/S  // Stop here to choose Ace value
LBL 3  // For card 2 and above
STO+1
21
RCL 1  // Total
X=Y
RTN  // Stop when 21
X>Y
GTO 2  // Lose
R/S
GTO A
--------------
LBL B  // Dealer
GSB 0  // Get Card
STO+2
21
RCL 2  // Total
PSE
X>Y
GTO 1  // Win
RCL 1  // Total from Player
X<>Y
X=Y  // Test for when Player and Dealer got the same amount
GTO 4  // Same Amount go ahead and decide if dealer decide to Hit or Stop.
X>Y
GTO 2  // Lose
GTO B
-----------
LBL C  // Ace for 11
11
GTO 3  // Player Select 11 and continue
----------
LBL D  // Bankroll
STO 3
RTN
----------
LBL E  // Place Bet and Clear previous data
STO 4
CLx
STO 1
STO 2
FIX 0
RCL 4
RTN
----------
LBL 0  // Random Algorithm 
10
RAN#
13
x
1
+
INT
X>Y
X<>Y  // 10. for Jack-Queen-King
RTN
----------
LBL 1  // Win
RCL 3
RCL 4
+
STO 3
CHS
RTN
---------
LBL 2  // Lose
RCL 1  // To see the card amount that call a lose game by pressing [X<>Y]  
RCL 3
RCL 4
-
STO 3
CHS
RTN
--------
LBL 4  // Tie ( draw or maybe not ? )
17
RCL 2
X>Y  // For card amount 18 to 21 call a Tie Game
GTO 5
RAN#  // Card amount < 18 Dealer "randomly" decide to call tie or continue
2
x
INT
X=0  // Dealer make random decision to call tie or continue  
GTO B
LBL 5  // Start here for a Tie Game effect notification
0
FIX 9
PSE  // Display 0.000000000 briefly to indicate a tie game 
FIX 0
RCL 3  // Bankroll Amount
CHS
RTN

EDIT: [7/10/2019]
Make changed to LBL 4
When both Player and Dealer got the same cards amount
Dealer will make a Hit from 16 and below.
17 and above Dealer will call a "Tie Game"

EDIT: [7/11/2019]
On LBL A make change after X=Y from GTO 1 to RTN
After this change when Player get 21 this will not automatically win and
Player let the Dealer continue. If Dealer also get 21 then it is now a "Tie Game"

EDIT: [7/21/2019]
Make changed to LBL 4
Now card amount > 17 will call Tie Game
Card amount < 18 will randomly call either Tie or Continue

Added [X<>Y] under [LBL] 2
If you lose and like to see your card amount simply press [X<>Y]

Gamo
Find all posts by this user
Quote this message in a reply
07-23-2019, 01:11 PM
Post: #2
RE: (11C) Blackjack - 21
Blackjack the Final Version

Program: https://www.dropbox.com/s/8w59oa0idq7zig...1.pdf?dl=0

Gamo
Find all posts by this user
Quote this message in a reply
02-13-2020, 10:22 PM (This post was last modified: 02-13-2020 10:40 PM by Rogier.)
Post: #3
RE: (11C) Blackjack - 21
Hi Gamo,

I stumbled upon your Blackjack program today. Nice work. You asked if anyone else has ideas. Well here's my attempt at a Blackjack program:

- I use 2 decks of cards.
- Cards drawn are administered in R0 through R6.
- The integer part of R0 is the total number of cards drawn.
- For each odd card 0,1 is added, for each even card 1 is added to the appropriate register. Either way 1 is added to R0 (lines 43-50).
- Once the count for a card reaches 0,8 or 8 no more cards of that value can be drawn and the program tries again (lines 33-47).
- The program takes 104 new cards if more than 90 cards have been drawn or randomly when a random# >0,9 is drawn (lines 5-15)
- Aces are counted as 1 or 11 automatically (lbl 2)
- The card administration cost me so many lines and registers that I couldn't fit in a scoring routine

USE:

B:
Starts a new game. (11C will show 0,9 when new cards are taken)
11C shows: first card 11C > first card player > player total after 2 cards.

A:
Take card > total with additional card (fix9 = Ace counted as 1)

C:
Pass. 11C plays. The calculator will draw cards until total > 16
Final result: aa,bb (Score 11C, Score Player)

Other labels:
1: 11C takes Card
2: Process Ace
3: Check whether 11C must pass

Flags:
F 0: Set > no Ace
F 1: Set > odd Card

Registers:
R I: R-nr last card (+1)
R 0: Cards, Aces
R 1: 2, 3
R 2: 4, 5
R 3: 6, 7
R 4: 8, 9
R 5: 10, B
R 6: V, H
R 7: Active player score
R 8: 1st Card 11C. After pressing C, contents of R7 and R8 are swapped (line 81-85)
R 9: Last card drawn


Attached File(s)
.pdf  01-Blackjack-11C.pdf (Size: 42.96 KB / Downloads: 12)

HP 33E, HP 11C, HP 48 SX, HP 35S
Find all posts by this user
Quote this message in a reply
02-14-2020, 05:51 AM (This post was last modified: 02-14-2020 12:54 PM by Gamo.)
Post: #4
RE: (11C) Blackjack - 21
Rogier

Thanks for trying my Blackjack game.
This program was adapted from HP-19C Games Solutions Handbook.

It was modify so that it is easier to play and also more fun to program it
to the HP-11C since it got the Ran# function and 5 labels.

With this program:
It is kind of hard to beat the "Automated Dealer"
I can't call this Dealer as an "AI" because it doesn't learn from the pass result
but simply make Random Decisions based on set amount of range that
be specify in program.

I test this by set the bankroll at 1000 and keep betting either small or large amount
of the bet. With about 18 or less games my bankroll is empty.

I'll try you program later and see how it is going and again thanks
for your interest on this game.

Remark:
My Blackjack Card Game version doesn't show the Dealer First Card instead
Player first start to draw cards until satify then the Dealer take turn.

Gamo
Find all posts by this user
Quote this message in a reply
02-15-2020, 06:10 AM
Post: #5
RE: (11C) Blackjack - 21
Rogier

I have try your game and found that it is really good.

Good idea to let the player see the first card from the Dealer.

The result display shown as DD.PP (Dealer and Player Score) that is very nice.

When I have time I might modify my version to let Player see the Dealer's first card.

Thanks

Gamo
Find all posts by this user
Quote this message in a reply
02-16-2020, 08:55 PM (This post was last modified: 02-16-2020 09:26 PM by Rogier.)
Post: #6
RE: (11C) Blackjack - 21
Your program triggered me to review my own. As a result I now have a version with a basic scoring routine

Code:

001 Lbl B
002 SF 0
003 0
004 Sto 7
005 9
006 0 
007 Rcl 0
008 X≤Y?
009 Ran Nr
010 ,
011 9
012 X>Y?
013 GTO 4
014 Rcl 9
015 Clr Reg
016 Sto 9
017 X≤Y?
018 Pse
019 LBL 4
020 GSB A
021 Sto-7
022 Sto 8 
023 Pse
024 SF 0
025 GSB A
026 Pse
027 Lbl A
028 CF 1
029 Ran Nr
030 1
031 3
032 *
033 1
034 +
035 Int
035 Sto ,0
037 2
038 /
039 Enter
040 Int
041 X≠Y?
042 SF 1
043 Sto I
044 Rcl (i)
045 F 1?
046 Frac
047 F 1?
048 ,
049 8
050 X≤Y?
051 GTO A
052 8
053 /
055 Sto + (i)
056 Rcl ,0
057 1
058 0
059 X›Y?
060 Rcl ,0
061 Sto + 7
062 1
063 Sto + 0
064 X=Y?
065 CF 0
066 Fix 9
067 F 0?
068 Fix 2
069 Rcl 7
070 Rtn
071 Lbl 2
072 1
073 1
074 Rcl 7
075 X≤Y?
076 1
077 0
078 Sto + 7
079 Rtn
080 Lbl C
081 F 0?
082 ISG
083 GSB 2
084 SF 0
085 1
086 Rcl 8
087 Rcl 7
088 Sto 8
089 Roll down
090 Sto 7
091 X=Y?
092 CF 0
093 Lbl 1
094 GSB A
095 F 0?
096 GTO 3
097 8
098 X≤Y?
099 GSB 2
100 Lbl 3
101 1
102 6
103 Rcl 7
104 Pse
105 X≤Y?
106 GTO 1
Lbl E
107 CF 0 
108 2
109 1
110 Rcl 8  
111 X>Y? 
112 GTO 5
113 Roll down
114 Rcl 7 
115 X>Y?
116 SF 0 
117 Rcl 8
118 X>Y? 
119 SF 0 
120 Lbl 5
121 1
122 F 0?
123 CHS
124 Sto – 9
125 Rcl 9

HP 33E, HP 11C, HP 48 SX, HP 35S
Find all posts by this user
Quote this message in a reply
02-16-2020, 09:25 PM (This post was last modified: 02-16-2020 09:42 PM by Rogier.)
Post: #7
RE: (11C) Blackjack - 21
It appears I can only change my code, not the accompanying text. So here is the documentation in a separate note.

In order to incorporate a scoring routine I moved the last card drawn from R9 to R,0. Then added Lbl 4, which saves R9 if registers are cleared when 11C takes new cards.

This enabled me to fit in a basic scoring system with 1 line to spare (if you delete Lbl E). Lbl 5 is inserted to handle player totals >21, F0 is used to determine if 1 or -1 should be subtracted from R9. I inserted "Lbl E" in the listing for readability and testing of the scoring routine only.

Scoring is as follows:
  • Score is kept in R9,
  • Standard bet is 1 credit, no other bets possible,
  • Player starts out at 0 credits (so positive values in R9 mean you are winning, negative values mean you are losing),
  • If player has >21 points he loses (Lbl 5), if not:
  • If 11C has > 21 points player wins, if not:
  • If player points > 11C points player wins,
  • If both passed with the same points 11C wins.

Use of A and B is as before. C now shows the total after each card 11C draws [Pse] and finally shows your credit balance. If you want to review the totals:
R7: 11C card score
R8: Player card score
R9: Credits

If you prefer the old system just delete all lines beyond Lbl E (from 107) and replace them by:
107 Rcl 8
108 EEX
109 2
110 /
111 +
(112 Rtn)

HP 33E, HP 11C, HP 48 SX, HP 35S
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)