(11c) Slot machine
|
08-21-2022, 08:02 PM
(This post was last modified: 08-30-2022 02:14 PM by Rogier.)
Post: #1
|
|||
|
|||
(11c) Slot machine
This program emulates a slot machine on an HP-11c calculator.
Use: Lbl D starts a new game, gives you 10 points and generates a 3-digit code; LMR [each 1 ... 7]. Output looks like: LMR,xxxyyy (Where xxx = points, yyy = number of turns played) Lbl E allows you to change L and/or M and/or R. Starting E costs 1 point. Achieving a number XXy or yXX gives you X points, Achieving a number XXX gives you 2*X points. Options: 1 > E: Change L 2 > E: Change M 3 > E: Change R 4 > E: Change L & M 5 > E: Change L & R 6 > E: Change M & R 8 > E: Change L, M & R You can't input the same number 2 times in a row. Registers Used: R0: Points R1: M R2: Temporarily used by Lbl 5 R3: R R4: L R5: Number of turns RI: Player choice Labels used: Lbl D: Start game Lbl E: Change L and/or M and/or R Lbl 0: Generate Ran.nr. [1, 2...7] Lbl 1: Change L Lbl 2: Change M Lbl 3: Change R Lbl 4: Change L & M Lbl 5: Change L & R Lbl 6: Change M & R Lbl 7: Compute score, build display Lbl 8: Change L, M & R Lbl 9: Initialise new game, CF1, replace L, M & R Flags used: F0: Set by Lbl 2 so Lbl 4 only changes M an then jumps to Lbl 7 (otherwise L would be changed as well). Set by Lbl 6 so Lbl 8 only changes M & R Set by Lbl 7 so negative player points are displayed correctly F1: Set by Lbl D so on first use, Lbl E will change L, M & R Set by Lbl 3 so Lbl 8 only changes R Set by Lbl 7 if points are scored (so Lbl E will change L, M & R on next use) Notes: This program basically was an excuse to use "Gto I", one of the few functions of my HP-11C I had never used before. I spent most time working out the way F0 and F1 control program flow. I think that that made it a more interesting program than a boring series of Gsb-commands. Besides, I used all numerical labels, so the "boring series" isn't that easy. I used the formula Int(((6,8*Ran#^2)+1,2) to calculate L, M & R, so higher numbers are more scarce than lower numbers. Adapt Lbl 0 if you prefer something else. Code: 001 Lbl D HP 33E, HP 11C, HP 48 SX, HP 35S |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)