Rolling Dice (32SII program is also included here)
|
06-09-2018, 03:05 PM
Post: #1
|
|||
|
|||
Rolling Dice (32SII program is also included here)
One way to simulate a pair of dice being thrown is to generate two random integers between 1 through 6. The integers are either shown as a pair or vector of integers. For calculators that do not have a list capacity or want a more compact representation, the program for the HP 32S II (which can easily apply almost to any other programming calculator), in the format A.0B, where A is one die and B is the other. For example, 3.06 represents a 3 and a 6 being thrown.
The formula would be: RandInt(1,6) + RandInt(1,6)/100 We can also use the Unicode representation of dice. Unicode/Decimal/Hexadecimal ⚀ 9856 2680 ⚁ 9857 2681 ⚂ 9858 2682 ⚃ 9859 2683 ⚄ 9860 2684 ⚅ 9861 2685 Unicode characters need to be in strings. The HP Prime program RDICE returns a list, the roll in compact format, along with the Unicode representation. This is only one of many ways to do it. An example output of RDICE is {4.02, “⚃”, “⚁”} HP Prime Program: RDICE Code:
HP 32 SII Program: Dice Generator Code:
Link to post: https://edspi31415.blogspot.com/2018/06/...-dice.html |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Rolling Dice (32SII program is also included here) - Eddie W. Shore - 06-09-2018 03:05 PM
|
User(s) browsing this thread: 1 Guest(s)