Casio fx-9750GIII: Spin the Wheel
Making the Wheel and String Commands
The wheel is comprised of a long string. Each space has an equal amount of characters, in this case I picked 5. To make the wheel "spin", I use the StrRotate.
StrRotate(Str n, s):
Str n: n from 1 to 20
s: number of spaces to rotate the string. If s>0 the string rotates left. If s<0, the string rotates right. The characters wrap around.
If Str1 = "TESTBOOKADAM"
StrRotate(Str 1,4) returns "BOOKADAMTEST"
StrRotate(Str 1,-4) returns "ADAMTESTBOOK"
Other commands used:
StrLeft(Str n, s): takes the left s characters of Str n
StrRight(Str n, s): takes the right s characters of Str n
StrMid(Str n, p, m): extracts the string starting at position n at m characters
The wheel used in this program:
BROKE (it's bankrupt said in five characters)
$ 650
$ 550
$ 900
$ 800
$ 700
PRIZE (prize space)
$1000
$ 600
$ 750
$ 500
$5000
5 characters per space is used.
Casio fx-9750GIII Program: SPIN
"2022-11-23 EWS"
"BROKE$ 650$ 550$ 900$ 800$ 700PRIZE$1000$ 600$ 750$ 500$5000"→Str 1
Lbl 1
RanInt#(20,48)→N
For 1→I To N
StrRotate(Str 1,5)→Str 1
StrLeft(Str 1,5)→Str 2
ClrText
Locate 10,3,"↓"
Locate 2,4,StrRight(Str 1,5)
Locate 8,4,Str 2
Locate 14,4,StrMid(Str 1,6,5)
Next
1DispsMenu "SPIN AGAIN?","YES",1,"NO",0
Lbl 0
ClrText
Locate 4,4,"THANK YOU"
↓ and $ are found in the CHAR menu.
Have fun,
Eddie
All original content copyright, © 2011-2023. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.