Post Reply 
(PC-1211) Multiple Dice Throw
03-21-2021, 09:29 AM (This post was last modified: 03-21-2021 10:21 AM by C.Ret.)
Post: #5
RE: (PC-1211) Multiple Dice Throw
Hello cheer PC-1211 enthusiasts !

Yes, a good flavor of BASIC with a lot of tricks and short-cuts which make this pocket a useful calculator...
Except for PRINT capabilities and, due to it's great age, speed of running (walking ?) programs !

As in most of applications (i.e.; Yahtzee, poker dice, ...), we need to display or print the listing of values of the dices we have just throwed.
Here is my solution for this delicate implementation on the venerable PC-1211 machine:

1:PRINT T;USING "##";A:RETURN
2:PRINT T;USING "##";A;B:RETURN
3:PRINT T;USING "##";A;B;C:RETURN
4:PRINT T;USING "##";A;B;C;D:RETURN
5:PRINT T;USING "##";A;B;C;D;E:RETURN
6:PRINT T;USING "##";A;B;C;D;E;F:RETURN
7:PRINT T;USING "##";A;B;C;D;E;F;G:RETURN
8:PRINT T;USING "##";A;B;C;D;E;F;G;H:RETURN
9:PRINT T;USING "##";A;B;C;D;E;F;G;H;I:RETURN
10:PRINT T;USING "##";A;B;C;D;E;F;G;H;I;J:RETURN

12:"Z"AREAD Z:BEEP (Z<=0)+(Z>=1):END
13:"N"AREAD N:IF (N<1)+(N>10)+(N<>INT N)BEEP 1:END
14:T=0:FOR K=1TO N:Z=(∏+Z)^5,Z=Z-INT Z,A(K)=1+INT 6Z,T=T+A(K):NEXT K:USING "###.":GOSUB N:GOTO 14


This code is conveniently use in DEF mode.
Enter a fractional seed and press [shift]+[ Z ] to initiate randomizing seed. The pocket beeps when seed if out of the ] 0 ; 1 [ range.
Enter the number of dices to throw and press [shit]+[ N ]. The pocket will display the total and all the dice’s values. It beeps when user ask for less than one dice or more than ten dices.
Pressing the [ ENTER ] key re-throw a full set of dices.

P.S.#1: To enter lines from 1 to 10, start with complete line 10 and go down to 1 by erasing extra characters with space, you will spare time and efforts...

P.S.#2: For the laziest of us, but limited to height dices throws:
1:"Z"AREAD Z:BEEP (Z<=0)+(Z>=1:END
2:"N"AREAD N:IF (N<1)+(N>8)+(N<>INT NBEEP 1:END
3:T=0:USING :FOR K=1TO N:Z=(∏+Z)^5,Z=Z-INT Z,T=T+(1+INT 6Z)*(1+10^-K:NEXT K:PRINT T:GOTO 3
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(PC-1211) Multiple Dice Throw - SlideRule - 03-20-2021, 11:48 AM
RE: (PC-1211) Multiple Dice Throw - C.Ret - 03-21-2021 09:29 AM
RE: (PC-1211) Multiple Dice Throw - robve - 03-23-2021, 02:43 PM
RE: (PC-1211) Multiple Dice Throw - robve - 03-23-2021, 03:56 PM
RE: (PC-1211) Multiple Dice Throw - pyedog - 03-23-2021, 04:06 PM



User(s) browsing this thread: 2 Guest(s)