Requirements: Size 024 and 656 bytes of program memory. Note: It will beep unless you clear flag 26 first. Wouldn't want anyone to get caught at work playing it.
Here's a short description. Yahtzee is somewhat like a poker game with dice. You get 13 "hands" of 5 dice to score into rows of a scorepad that are specifically for a certain combination of dice. The row numbers presented below are needed during the game to tell the HP where to score the current roll of dice. Keep these handy!
Rows 1-6 are for scoring as many 1's and 6's as you can. Rows 7 and 8 are for three and four of a kind, respectively. Row 9 is for a full house (Like 1,1,4,4,4 or 3,3,6,6,6, etc.) Row 10 is for a straight of 4 in a row (Like 1,2,3,4 or 3,4,5,6, etc.) Row 11 is for a straight of five in a row (Like 1,2,3,4,5 or 2,3,4,5,6) Row 12 is for 5 of a kind or a Yahtzee. Row 13 is called "Chance", in case you need a spare chance.
To help you get the dice you need, you are given three "rolls" to make the best you can out of the 5 dice. When they are first rolled, pick the ones you want to roll again. When they are re-rolled, you get to pick some to roll the second time. However, once that is done, you must choose a row to score the 5 dice in.
You get a bonus of 35 points if you score 63 or better in the top 6 rows. To get 63, you must average three 1's, 2's, etc.
Rows 7 and 8 will score the total of the dice that are showing. Row 9 scores 25, Row 10 scores 30, and Row 11, scores 40. The Yahtzee (Row 12) scores 50. Chance scores like rows 7 and 8, providing the total of the displayed dice.
It is possible to get two (or more) Yahtzees in a game. The first should be scored in row 12, but to get the 100 point bonus from numbers 2, etc., you must be able to score it in a row as usual. For example, if you get a second Yahtzee of 2's, you can score it for a bonus in Row 2, Row 7, Row 8, Row 9, or Row 13. To indicate to the program to c heck for this bonus, enter the Row to be used as a NEGATIVE Number! Note: You can't score an extra Yahtzee in Rows 10 or 11.
To play, make sure you have a Size of 024, XEQ YZ , and enter a decimal seed. The display will show the 5 dice you rolled in sorted order with the prompt ROLL? at the end of the display. Pick the dice you wish to roll again and enter their position numbers, and press R/S. You can do this twice before having to score the roll. If you don't want to roll any of the dice over, simply press R/S to go straight to scoring.
For example, if the display is showing 22256 and you want to try for 2's, you would press 45 R/S. But, if on the first roll you got 12345, you might want to just score it as a large straight (if not already used) by pressing R/S without entering anything.
After your second re-roll, you are shown the dice and prompted with SCORE? Enter the row you wish to score the roll into and press R/S. If you enter a row that has already been used, you get the SCORE prompt again. If you are not sure which rows remain to be used, press R/S without entering anything and you will be shown a list of the unused rows. The scoring routines will detect when no points should be given and will assign a zero to the row if needed.
You can save some bytes if you always have a PPC ROM plugged in by changing Label 40 to be LBL 40, 14.018, XROM S2, RTN. (If you have a CCD module, replace the XROM S2 with SORT). This will save about 55 bytes. The current sort routine at label 40 uses a mode change from Degrees to Radians to indicate that a number swap has occurred. (It's kind a fun to watch the RAD switch on and off.) The game is somewhat slow the first time through, but speeds up later.
What's a good score? Anything over 250 is good, but with extra Yahtzee's, you can get up over 450 or higher. Trivia: What's the lowest possible score?
The column for "See:" indicates what is shown in the calculator display. The column for "Press:" indicates what you must type in. Remember: unless you clear flag 26, the program may BEEP at you during play!
See: Press: XEQ YZ SEED? 0.123456789 R/S 11246 ROLL? 15 R/S 12445 ROLL? 45 R/S 12234 SCORE? 10 R/S ROW 10=30 25666 ROLL? 12 R/S 46666 ROLL? 1 R/S 66666 SCORE? 12 R/S ROW 12=50 (Hear a beep) 14556 ROLL? 125 R/S 13355 ROLL? 123 R/S 12455 SCORE? 1 R/S ROW 1=1 22366 ROLL? 345 R/S 22333 ROLL? 0 R/S 22333 SCORE? 9 R/S ROW 9=25 24446 ROLL? 15 R/S 24445 ROLL? 15 R/S 11444 SCORE? 4 R/S ROW 4=12 13346 ROLL? 145 R/S 13336 ROLL? 15 R/S 13333 SCORE? 3 R/S ROW 3=12 22266 ROLL? 45 R/S 22222 ROLL? 0 R/S 22222 SCORE? -2 R/S (To get the yahtzee bonus, it's a negative two) ROW 2=10 +100 (This is because it's our second yahtzee of the game) 12236 ROLL? 145 R/S 22236 ROLL? 45 R/S 11222 SCORE? 7 R/S ROW 7=8 11556 ROLL? 1234 R/S 44666 ROLL? 12 R/S 46666 SCORE? 6 R/S ROW 6=24 24446 ROLL? 15 R/S 24446 ROLL? 15 R/S 23444 SCORE? 13 R/S ROW 13=17 12466 ROLL? 15 R/S 23466 ROLL? 4 R/S 23456 SCORE? 11 R/S ROW 11=40 12345 ROLL? 1234 R/S 13566 ROLL? 1245 R/S 14555 SCORE? 0 R/S 5,8, 14555 SCORE? 5 R/S ROW 5=15 13466 ROLL? 123 R/S 25666 ROLL? 12 R/S 34666 SCORE? 8 R/S ROW 8=0 DONE TOP=74+35 LOWER=270 END=379Not too bad. Press R/S for another game. Note: If you choose not to play another game and leave YZ to do something else, the flags are left set in end of game condition.
Line Instruction 01 LBL "YZ" 02 CLRG 03 "SEED?" 04 PROMPT 05 STO 00 06 LBL 16 07 .02 08 LBL 14 09 CF IND X 10 ISG X 11 GTO 14 12 14.018 13 STO 23 14 FIX 0 15 CF 29 16 LBL 15 17 12345 18 GTO 71 19 LBL 17 20 1 21 ST+ 19 22 RCL 19 23 3 24 X<=Y? 25 GTO 22 26 ->" ROLL?" 27 LBL 27 28 CLX 29 PROMPT 30 INT 31 X<0? 32 GTO 27 33 X=0? 34 SF 00 35 X=0? 36 GTO 61 37 LBL 71 38 10 39 / 40 ENTER 41 INT 42 X<>Y 43 FRC 44 10 45 * 46 X=0? 47 GTO 20 48 5 49 X<>Y 50 X>Y? 51 GTO 72 52 X<>Y 53 RDN 54 13 55 + 56 RCL 00 57 997 58 * 59 FRC 60 STO 00 61 6 62 * 63 1 64 + 65 INT 66 STO IND Y 67 LBL 72 68 RCL Z 69 GTO 71 70 LBL 20 71 XEQ 40 72 LBL 61 73 CLA 74 ARCL 14 75 ARCL 15 76 ARCL 16 77 ARCL 17 78 ARCL 18 79 FS?C 00 80 GTO 22 81 GTO 17 82 LBL 65 83 ABS 84 RCL 12 85 X=0? 86 GTO 61 87 RDN 88 RCL 14 89 RCL 18 90 X=Y? 91 SF 20 92 RCL Z 93 GTO 64 94 LBL 22 95 ->" SCORE?" 96 LBL 66 97 CLX 98 CF 20 99 PROMPT 100 INT 101 13 102 X<>Y 103 X>Y? 104 GTO 66 105 X=0? 106 GTO 25 107 X<0? 108 GTO 65 109 FS? IND X 110 GTO 66 111 LBL 64 112 STO 21 113 RCL 23 114 STO 22 115 CLX 116 STO 19 117 STO 20 118 XEQ IND 21 119 CF 00 120 "ROW " 121 ARCL 21 122 ->"=" 123 ARCL 20 124 AVIEW 125 RCL 20 126 STO IND 21 127 SF IND 21 128 X NE 0? 129 FC?C 20 130 GTO 63 131 2 132 10^X 133 ST+ 12 134 "+" 135 ARCL X 136 PSE 137 AVIEW 138 PSE 139 LBL 63 140 CLX 141 STO 20 142 1.013 143 LBL 75 144 FC? IND X 145 GTO 15 146 ISG X 147 GTO 75 148 "DONE" 149 AVIEW 150 RCL 01 151 RCL 02 152 RCL 03 153 RCL 04 154 + 155 + 156 + 157 RCL 05 158 + 159 RCL 06 160 + 161 "TOP =" 162 ARCL X 163 ->"+" 164 63 165 X<=Y? 166 35 167 X>Y? 168 0 169 ARCL X 170 X<>Y 171 RDN 172 + 173 AVIEW 174 PSE 175 RCL 07 176 RCL 08 177 RCL 09 178 + 179 + 180 RCL 10 181 + 182 RCL 11 183 + 184 RCL 12 185 + 186 RCL 13 187 + 188 "LOWER=" 189 ARCL X 190 AVIEW 191 PSE 192 + 193 "END=" 194 ARCL X 195 PROMPT 196 GTO 16 197 LBL 25 198 CLA 199 1.013 200 LBL 00 201 FC? IND X 202 ARCL X 203 FC? IND X 204 =>"," 205 ISG X 206 GTO 00 207 AVIEW 208 PSE 209 GTO 61 210 LBL 01 211 LBL 02 212 LBL 03 213 LBL 04 214 LBL 05 215 LBL 06 216 RCL IND 22 217 RCL 21 218 X=Y? 219 ST+ 20 220 ISG 22 221 GTO 06 222 RTN 223 LBL 13 224 FS?C 14 225 RTN 226 RCL 14 227 RCL 15 228 RCL 16 229 RCL 17 230 + 231 + 232 + 233 RCL 18 234 + 235 STO 20 236 RTN 237 LBL 12 238 RCL 18 239 RCL 14 240 X NE Y? 241 RTN 242 BEEP 243 50 244 STO 20 245 RTN 246 LBL 07 247 RCL 14 248 RCL 16 249 X=Y? 250 GTO 13 251 RCL 18 252 X=Y? 253 GTO 13 254 RCL 17 255 RCL 15 256 X=Y? 257 GTO 13 258 RTN 259 LBL 08 260 RCL 14 261 RCL 17 262 X=Y? 263 GTO 13 264 RCL 15 265 RCL 18 266 X=Y? 267 GTO 13 268 RTN 269 LBL 09 270 SF 14 271 XEQ 07 272 FS?C 14 273 RTN 274 RCL 14 275 RCL 15 276 X NE Y? 277 RTN 278 RCL 17 279 RCL 18 280 X NE Y? 281 RTN 282 25 283 STO 20 284 RTN 285 LBL 11 286 RCL 23 287 + 288 LBL 35 289 RCL IND X 290 ISG Y 291 RCL IND Y 292 1 293 - 294 - 295 X NE 0? 296 RTN 297 RDN 298 18 299 X<=Y? 300 GTO 36 301 RDN 302 GTO 35 303 LBL 36 304 40 305 FS?C 00 306 30 307 STO 20 308 RTN 309 LBL 10 310 RCL 15 311 RCL 14 312 - 313 1 314 X NE Y? 315 CLX 316 X=0? 317 STO 14 318 RCL 17 319 RCL 16 320 RCL 15 321 RCL 14 322 X=Y? 323 CLX 324 STO 14 325 RDN 326 X=Y? 327 CLX 328 STO 15 329 RDN 330 X=Y? 331 CLX 332 STO 16 333 RDN 334 RCL 18 335 X<>Y 336 X=Y? 337 CLX 338 STO 17 339 XEQ 40 340 RCL 15 341 X=0? 342 RTN 343 RCL 14 344 X=0? 345 GTO 41 346 RCL 18 347 RCL 17 348 - 349 1 350 X=Y? 351 GTO 41 352 30 353 STO 20 354 RTN 355 LBL 41 356 1 357 SF 00 358 GTO 11 359 LBL 40 360 DEG 361 RCL 17 362 RCL 16 363 RCL 15 364 RCL 14 365 X>Y? 366 RAD 367 X>Y? 368 X<>Y 369 STO 14 370 RDN 371 X>Y? 372 RAD 373 X>Y? 374 X<>Y 375 STO 15 376 RDN 377 X>Y? 378 RAD 379 X>Y? 380 X<>Y 381 STO 16 382 RDN 383 RCL 18 384 X LT Y? 385 RAD 386 X LT Y? 387 X<>Y 388 STO 18 389 X<>Y 390 STO 17 391 FS? 43 392 GTO 40 393 END
Note: The LT in steps 384 and 387 are Less Than and should be the normal symbol from the HP41. My html does not like that symbol!