(11C) Roll Two Dice at Random - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (11C) Roll Two Dice at Random (/thread-11103.html) |
(11C) Roll Two Dice at Random - Gamo - 07-22-2018 09:44 AM This program is the improved version of the "Roll Two Dice at Random" previously posted on the general software library for (12C) http://www.hpmuseum.org/forum/thread-10565.html This version display the face result of Two Dice at the same time and total up. Example: f [A] Two dice randomly roll display 3.5 First dice face is 3 Second Dice face is 5 Total is 8 Calculator display 3.5 pause and show total of 8 Program: Roll Two Dice at Random Code:
Gamo RE: (11C) Roll Two Dice at Random - Thomas Klemm - 07-22-2018 01:13 PM Based on Werner's idea this is what I came up with: Code: 001-42,21,11 LBL A Kind regards Thomas RE: (11C) Roll Two Dice at Random - Thomas Klemm - 07-22-2018 02:49 PM Or then you ditch the idea and don't use registers at all: Code: 001-42,21,11 LBL A RE: (11C) Roll Two Dice at Random - Gamo - 12-29-2018 01:54 AM Roll Two Dice at Random Updated Version II This update shown two dice as on previous program but total on exponent. Display will show as X.X ________XX Program: Code:
Gamo RE: (11C) Roll Two Dice at Random - Dieter - 12-29-2018 09:09 AM (12-29-2018 01:54 AM)Gamo Wrote: Roll Two Dice at Random Updated Version II There is no need to use a second data register – both random numbers are kept on the stack. You may simply remove both the STO 2 and the RCL 2 commands. Dieter RE: (11C) Roll Two Dice at Random - Gamo - 12-29-2018 12:58 PM Dieter thanks now I make changed as suggested. Gamo RE: (11C) Roll Two Dice at Random - Dieter - 12-29-2018 07:30 PM (12-29-2018 09:09 AM)Dieter Wrote: There is no need to use a second data register – both random numbers are kept on the stack. You may simply remove both the STO 2 and the RCL 2 commands. There is no need to waste even a single data register. It can all be done on the stack: Code: 01 LBL A Dieter |