Bob's Calculator Version 2.0 Updated: 2005.02.01  
  Home     Main screen     Forms     Programming     Customization  
   Overview       Run       View       Add/Edit       Commands       Samples   

Sample programs

Dice
H->h.mmss
h.mmss->H
Dice
This program takes the entered value and generates a random between 1 and that number. To simulate a 6-sided die roll, you would first tap the "6" button, then "Enter", then the "Dice" program button. Successive executions do not require entering the original number again.

StepLblActionNote
1RPNSet the program to run in RPN mode
2R<dn>Roll target value back to X register
3EnterPush target value back onto stack
4Ran#Generate random number between 0 and 1
5xMultiply by target value
61.00Key in the rounding amount.
7+Add rounding amount.
8IntTake the interger portion.
9Fix0Set the display to show only the whole number.
10r/sStop

The new random number, scaled from 1 to the initial target value, will be displayed. The target value is still stored in the Y register, and will be used for subsequent executions. To change the target value, simply enter a new number before running the program again.




(c) 2005 RarM_Software