Post Reply 
(32SII) Two Versions of Slots
06-03-2018, 05:10 PM (This post was last modified: 06-03-2018 05:11 PM by Eddie W. Shore.)
Post: #1
(32SII) Two Versions of Slots
Link to post: https://edspi31415.blogspot.com/2018/06/...slots.html

Note: Symbols that are produced by Unicode should, but may not show up on all browsers. Please make sure your browsers are updated to the latest version.

Take a Spin

The two programs are three reel slot simulators, each with ten symbols:

0: BAR
1: Cherry
2: Orange
3: Plum
4: Bell
5: Lemon
6: Watermelon
7: Seven
8: Apple
9: Shamrock

Slots Version 1: Classic Adapted Version

This version is adapted from the HP-19C/HP-29C Games Solutions: Games book, which in turn, the original program was adapted from HP-65 user program by Craig A. Pearce.

Each spin has an ante of 10¢. The results appear in the form 0.### (ignore the left most 0.)

The payouts are these:

Cherry on the first slot, 0.1xy: 20¢
Cherry on the first two slots 0.11x: 30¢
Three of a kind other than cherries, 0.xxx where x≥2: $1.00
Non-cherry symbol on the first two slots, BAR on the third, 0.xx0 where x≥2: $1.00
Three BARS, 0.000: $10.00

To operate:

1. Initialize: XEQ S
2. Spin: XEQ J
3. Check your winnings or losses: XEQ K

HP 32S II Program Classic Slots
(115.5 bytes)
Code:

// initialize (4.5 bytes)
S01 LBL S
S02 CLVARS
S03 STOP (R/S)

// spin (40.5 bytes)
J01 LBL J
J02 FIX 3
J03 RANDOM
J04 STO N
J05 XEQ T
J06 STO K
J07 –
J08 XEQ T
J09 STO L
J10 –
J11 XEQ T
J12 STO M
J13 1
J14 RCL K   // check for cherries
J15 x=y?
J16 GTO O
J17 RCL L
J18 x≠y?
J19 GTO P
J20 RCL M
J21 x≠y?
J22 GTO Q
J23 1
J24 XEQ U
J25 1 
J26 STO U
J27 R↓ 

// three of kind check (7.5 bytes)
Q01 LBL Q
Q02 x≠0?
Q03 GTO P
Q04 9
Q05 DSE U

// pay the ante of 10 cents (12.5 bytes)
P01 LBL P
P02 RCL N
P03 -0.1

// accounting of the pot (6.0 bytes)
U01 LBL U
U02 STO+ J
U03 R↓ 
U04 RTN

// cherry routine (29.5 bytes)
O01 LBL O
O02 0.2
O03 XEQ U
O04 RCL L
O05 x≠y?
O06 GTO P
O07 0.3
O08 XEQ U
O09 GTO P

// peel digits from the spin (9.0 bytes)
T01 LBL T
T02 10
T03 *
T04 ENTER
T05 IP
T06 RTN

// recall pot (6.0 bytes)
K01 LBL K
K02 RCL J
K03 FIX 2
K04 STOP (R/S)

Source: HP-19C/29-C Solutions: Games. Hewlett Packard. 1977


Slots Version 2: Cherries and Triples Pay

Each spin has an ante of 25¢. The results appear in the form 0.### (ignore the left most 0.) See the Take a Spin section above for the symbols used in the game.

The payouts are these:

A cherry in any one slot (0.1xy, 0.x1y, or 0.xy1): $1.00
Any two cherries (0.11x, 0.1x1, 0.x11): $10.00
Three BARS (0.000): $35.00 ($15 + $20)
Three Sevens (0.777): $70.00 ($50 + $20)
Any other triple (0.xxx, x≠0 and x≠7): $20.00

To operate:

1. Initialize and store your bank roll: XEQ S
2. Spin: XEQ J. The results of the slot and the resulting bank roll will automatically be displayed.

HP 32S II Program Cherries and Triples Pay
(124.0 bytes)
Code:

// initialization (6.0 bytes)
S01 LBL S
S02 CLRVARS
S03 STO J
S04 STOP (R/S)

// spin (62.5 bytes)
J01 LBL J
J02 0
J03 STO P // store in P
J04 0.25  // ante
J05 STO- J
J06 FIX 3
J07 RANDOM
J08 RND  // round to display settings
J09 PSE
J10 PSE
J11 PSE
J12 STO N
J13 0.111  // check for triple
J14 ÷ 
J15 STO S
J16 FP
J17 x=0?
J18 GTO T
J19 RCL N  // count for cherries
J20 XEQ P 
J21 RCL S
J22 XEQ P
J23 RCL S
J24 XEQ P
J25 RCL P
J26 1 
J27 –
J28 10^x  
J29 IP
J30 STO+ J
J31 GTO U

// count cherries (21.0 bytes)
P01 LBL P
P02 10
P03 *
P04 ENTER
P05 IP
P06 –
P07 STO O
P08 LASTx
P09 1
P10 x≠y?
P11 RTN
P12 1
P13 STO+ P
P14 RTN

// check the triple (16.5 bytes)
T01 LBL T
T02 RCL S
T03 x=0? // 3 bars
T04 XEQ K
T05 RCL S
T06 7
T07 x=y? // 3 sevens
T08 XEQ L
T09 20
T10 STO+ J
T11 GTO U

// add bonus for 3 bars (6.0 bytes)
K01 LBL K
K02 15
K03 STO+ J
K04 RTN

// add bonus for 3 sevens (6.0 bytes)
L01 LBL L
L02 50
L03 STO+ J
L04 RTN

/// show balance (6.0 bytes)
U01 LBL U
U02 RCL J
U03 FIX 2
U04 STOP (R/S)

Good luck!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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