Showing posts with label locate. Show all posts
Showing posts with label locate. Show all posts

Saturday, January 21, 2023

Casio fx-9750GIII: Spin the Wheel

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. 


Saturday, January 7, 2023

Casio fx-9750GIII: Decimal Expansion of a Fraction

Casio fx-9750GIII:  Decimal Expansion of a Fraction


Introduction - Happy New Year!


The program DEC21 finds a decimal expansion of a positive fraction.  This program is based on Barry Kissane's DECIMAL program from "Programming Your Calculator: Casio fx-7400G Plus" (see source below).  



Casio fx-9750GIII Program:  DEC21

244 bytes


"2022-11-22 EWS"

"FRACTION EXPANSION"

"NUM.(>0) "?→N

"DEN.(>0) "?→X

Int log (N/X)+1→T

ClrText

Locate 1,2,N

Locate 13,2,"÷"

Locate 1,3,X

Locate 13,3,"≈"


For 1→I To 21

If T=0

Then 

Locate I,5,"."

I+1→I

IfEnd

Int (N÷X)→D

10*(N-D×X)→N

Locate I,5,D

T-1→T

Next

Locate 18,1,"   "


Note:  the approximate symbol, ≈, is found in the CHAR menu.


Examples:


Example 1:

558/127


NUM:  558

DEN:  127


Result:

558 ÷

127 ≈


4.3937007874015748031



Example 2:

5/27


NUM: 5

DEN: 27


5  ÷

27  ≈


0.1851851851851851851


Here's to a great 2023!



Source


Kissane, Barry.  Programming Your Calculator: Casio fx-7400G Plus. Chatswood NSW, Australia, 2000. ISBN 0 9758302 0 3.   


Eddie



Remember, my regular posting schedule for January and February 2023 is on Saturdays only. 


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. 


Symmetric Quartic Equation - Python

Symmetric Quartic Equation - Python Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopt...