Digital Dice - Sharp EL-5230 Operation Manual

Programmable scientific calculator
Table of Contents

Advertisement

Chapter 8: Application Examples

Digital dice

This program simulates rolling of multiple dice. You can
play a dice game without dice or where there is not
enough space to roll dice.
At the first stage, ask the number of dice to use for play. Secondly, roll dice
and display the result and wait until any key is pressed.
Press b 2 1 0 to open a window for creating a NEW program.
1.
Type DICE for the title then press e.
2.
• A NEW program called 'DICE' will be created.
3.
Enter the program as follows.
Program code
Print"NO OF DICE
Input N
Label PLAY
M=1
X=0
Label ROLL
X=X+r.dice
M=M+1
If M<=N Goto ROLL
Print X
Wait
Goto PLAY
Running the program
Press j to return to the PROG mode menu.
4.
Press 0, select the program 'DICE' and press e.
5.
Enter the number of dice to play and press e.
6.
Press e (or any other key) to continue to play. Press j to quit.
7.
106
Key operations
i 1 @ a NO s OF
s DICE ; e
i 2 ; N e
i 6 @ a PLAY ; e
; M ; = 1 e
; X ; = 0 e
i 6 @ a ROLL ; e
; X ; = ; X + @
w 1 e
; M ; = ; M + 1 e
i 8 ; M i E ; N
; s i 9 @ a
ROLL ; e
i 0 ; X e
i 3 e
i 9 @ a PLAY ; e

Advertisement

Table of Contents
loading

This manual is also suitable for:

El-5250

Table of Contents