HP Forums

Full Version: (15c)(35s) Yahtzee (Yam) game
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,
This is a simple Yahtzee game for the HP35s.

Usage :
Start the game by fixing display to 0 (it could be done programmatically, but I prefer letting these kind lf things done by the user), then enter 0 and XEQ Y.

The computer choses 5 dice, eg 45331
You can chose the dice you want to keep by simply keying them, eg 33
Then start the program again with R/S.
The next roll will only chose the dice you need, keeping the ones you selected, eg 33613
To start with a roll of all 5 dice simply key 0 then R/S.

Example :
0
XEQ Y (ENTER)

display: 12565

125
R/S

display: 12533

1253
R/S

display: 12534

You did it!

Next player: 0 R/S

Code:

Y001 LBL Y
Y002 SF 10
Y003 YAM
Y004 PSE
Y005 CF 10
Y006 STO N
Y007 X<=0?
Y008 GTO Y015
Y009 LOG
Y010 IP
Y011 4
Y012 -
Y013 +/-
Y014 GTO Y016
Y015 5
Y016 STO I
Y017 10^x
Y018 STOx N
Y019 RANDOM
Y020 6
Y021 x
Y022 1
Y023 +
Y024 IP
Y025 RCL I
Y026 1
Y027 -
Y028 10^x
Y029 x
Y030 STO+ N
Y031 DSE I
Y032 GTO Y019
Y033 RCL N
Y034 STOP
Y035 GTO Y001
Because nobody asked for it, I created the HP15c version!

Same usage :
Start the game by fixing display to 0, then enter 0 and USER E.

The computer choses 5 dice, eg 45331
You can chose the dice you want to keep by simply keying them, eg 33
Then start the program again with USER E.
The next roll will only chose the dice you need, keeping the ones you selected, eg 33613
To start with a roll of all 5 dice simply key 0 then USER E.

Example :
0
USER E

display: 12565

125 (keep dice 1, 2 and 5)
USER E

display: 12533

1253
USER E

display: 12534

You did it!

Next player: 0 USER E

Code:


001 LBL E
002 STO 5
003 X<=0 (test 4)
004 GTO .1
005 LOG
006 INT
007 4
008 -
009 CHS
010 GTO .2
011 LBL .1
012 5
013 LBL .2
014 STO I
015 10^x
016 STOx 5
017 LBL .3
018 RAN#
019 6
020 x
021 1
022 +
023 INT
024 RCL I
025 1
026 -
027 10^x
028 x
029 STO+ 5
030 DSE I
031 GTO .3
032 RCL 5
033 RTN

Uses:
Registers 5 and I (you can change them easily)
Labels E, .1, .2, .3
Reference URL's