TI-84 Plus CE: All In Chance Game
The All In Chance Game
The objective is to get a high score by stopping the 2 x 2 board like this:
A B
C D
You score the sum of all four values. Watch for negative values and zeroes.
Spots B, C, and D range from -2 to 5, while A has four possible values: -5, 0, 5, 10.
How many spins you get? The game has a spinner from 2 to 7 spins.
Free spins can be earned. One way is to stop the board when A = 10. There are two other ways, can you discover them?
TI-84 Plus CE Program: ALLIN
(605 bytes)
Full
ClrHome
Output(1,1,"ALL IN GAME")
Output(2,1,"EWS 2022")
Wait 0.5
Output(4,1,"HOW MANY")
Output(5,1,"SPINS?")
Wait 0.5
0
Repeat Ans
randInt(2,7)→S
ClrHome
Output(1,3,"PRESS ANY KEY")
Output(3,3,"SPINS:")
Output(3,11,S)
Wait 0.25
getKey
End
ClrHome
Output(4,3,"YOU GOT")
Output(5,3,S)
Output(5,5,"SPINS!")
Output(7,3,"GOOD LUCK!")
Wait 0.8
0→T
0→M
While S>0
0
Repeat Ans
augment(5*randInt(1,2,1),randInt(2,5,3))→L6
ClrHome
Output(1,1,"SPINS LEFT: "+toString(S))
Output(3,4,L6(1))
Output(3,8,L6(2))
Output(6,4,L6(3))
Output(6,8,L6(4))
Output(8,1,"PRESS ANY KEY")
Wait 0.2
getKey
End
sum(L6)→P
T+P→T
If P>M:P→M
If L6(1)=L6(4) or L6(1)=10
Then
Output(1,1,"****FREE SPIN!****")
S+1→S
End
Output(8,1,"YOU GOT "+toString(P)+" ")
Output(9,1,"TOTAL: "+toString(T))
Output(10,1,"PRESS ENTER")
Pause
S-1→S
End
ClrHome
Disp "FINAL SCORE: "+toString(T)
Disp "BEST SPIN: "+toString(M)
Notes:
On the line Output(8,1,"YOU GOT "+toString(P)+" "), extra spaces are needed to "erase" the PRESS ANY KEY message.
0 is entered before the Repeat Ans loop to make Ans "false", allowing for the loop to happen and the player to press any key to exit the loop. See the TI-Basic Developer's page for more details: http://tibasicdev.wikidot.com/getkey
Source:
"The getKey Command" TI-BASIC DEVELOPER: The TI-BASIC INFORMATION REPOSITORY. Retrieved February 6, 2022. http://tibasicdev.wikidot.com/getkey
This program is made with OS 5.7, but it should work on O.S versions 5.5 and 5.6. Earlier OS versions may not have the Wait and toString commands.
L6 refers to List 6, [ 2nd ] [ 6 ].
Download the file here:
https://drive.google.com/file/d/1QkrXnt6dR1KgEy-2d9JQxE7jmQS93Drk/view?usp=sharing
HP 32S and HP 32SII Week: May 2, 2022 - May 6, 2022
Good luck!
Eddie
All original content copyright, © 2011-2022. 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.