(PC-1211) Multiple Dice Throw
03-20-2021, 11:48 AM (This post was last modified: 03-24-2021 03:45 PM by SlideRule.)
Post: #1
 SlideRule Senior Member Posts: 1,462 Joined: Dec 2013
(PC-1211) Multiple Dice Throw
An excerpt from Science and Engineering Sourcebook, page 87:

Description
Many games, e.g. the popular YAH-T-ZEE, and even computer modeling simulations, are based on the outcome of the multiple dice throw. This program permits a throw of 1 to 9 dice and displays the results of each multiple throw. The pseudo random generator shown in line 70, which does the "throwing," works well in the applications to which I submitted it; however, if you have your own favorite feel free to replace that line.
Program Listing
10: "Z"CLEAR :PAUSE "MULTIPLE DICE":USING
20: INPUT "STARTER= ";B
30: INPUT "HOW MANY DICE?";A
40: IF (A>0)*(A<10)*(A=INT A)THEN 60
50: BEEP 1:PAUSE "ERROR":GOTO 30
60: FOR I=1TO A
70: B=997B+π :B=B-INT B:C=INT 6B+1
80: D=C*10^(I-1)+D:NEXT I
90: PRINT A;" DICE=";D
100: D=0:GOTO 30

INSTRUCTIONS
Shift Z initializes the program and displays a prompt for a seed to start the pseudo random sequence. For best results, enter a number between 0 and 1. Next comes the prompt HOW MANY DICE for this throw. After a number n between 1 and 9 is entered, the program displays a n-digit number where each digit is between 1 and 6 and corresponds to a die. Pressing ENTER starts the sequence for another dice throw.

BEST!
SlideRule