Gw Temp

Menu

Tutorial - 'Guess the Number Game for Ti-83+ (Ti-Basic languag' by doktormartini

An item about Programming Languages posted on

Blurb

A tutorial that shows newbies how to use TI-BASIC to create a simple guess-the-number game.

Body

Hey all. I’m going to attempt to make a tutorial. This is my first one, so it make suck and have many spelling errors and stuff. Oh well. I will be teaching beginners of the Ti-Basic programming language how to make a cool guess the number game. Actually, it’s not cool, but you’ll feel good once you make it.
Turn the calculator on and go to PRGM then NEW. Name it something relevant like guess or number. Now we have to start with the code. Each command line starts with a colon (:) that is automatically put there for you. That’s a plus. Most of the programming function can be found by pressing PGRM while working on the code, that is also a plus. Now for the code, after every piece of code I will put a description in [], so don’t actually input it in the code unless you are dumb and want a syntax error. Most of us don’t. Let’s get to the code!!!J


:ClrHome [Clears whatever was on the screen previously.]
:randInt(1,50)àA [Press 2nd then 0(catalog) and find ranInt(. This picks a random number from 1-50 and puts it into variable A.]
:0àC [Makes the variable C equal 0. We will use this later to display the number of tries.]
:Disp “Pick a number” [Says pick a number on the screen.]
:Disp “From 1 to 50” [Says from 1 to 50 on the screen]
:Lbl 11 [Creates a label to go to later.]
:Input B [Input your guess which is a variable, B.]
:If A=B [If the correct number equals your guess.]
:Then [Then do the following.]
:Disp “Correct” [Says correct on the screen.]
:Disp “Tries:”,C [The variable for number of tries, C, is displayed here.]
:Pause [Pauses the program. Push enter to continue.]
:ClrHome [Clears whatever is on the screen.]
:Stop [Ends the program and show the word DONE on the screen.]
:Else [Do this if A didn’t equal B]
:If A>B [If the correct number is higher than your guess.]
:Then [Then do the following.]
:C+1=C [Adds 1 to C meaning that you took 1 try already.]
:Disp “Too Low” [Says too low on the screen telling you to guess a higher number.]
:Goto 11 [Goes to label 11 letting you guess again.]
:Else [Do this is A isn’t greater than B.]
:If A :Then [Then do the following.]
:C+1=C [Adds 1 to C meaning you took 1 try already.]
:Disp “Too High” [Says too high on the screen telling you to guess a lower number.]
:Goto 11 [Goes to label 11 letting you guess again.]

That’s the code for the guess the number game. If you have the Mirage OS, and you want this program to be read by it, just add another colon (:) at the first command line before the ClrHome.
If there are any errors or stuff like that, it’s my fault cause this is my first tutorial and I typed it kinda fast. Hope this helps some people because I know that it would help me if I didn’t understand Ti-Basic. Have fun!!! J

-Dok