Summary Edit

Guessing games are one of the simplest types of games: a number is chosen by the system, and the user tries to guess what it is. Our program will also tell the user whether their guess is higher or lower than the actual number.

Program Edit

Needed Commands: randInt(, Input, Disp, If, Lbl, =, >, <, Goto
General Commands: ClrHome, Output(, Pause

Like it has been said elsewhere, interactivity is one of the key points to making a good program. To start our guessing game program, we are going to either let the user pick his level of difficulty or enter the numbers the computer is going to pick a number between. Your program should only have one of these beginnings, but both are listed for you to choose from.

Opening Screen

:Lbl A
:Output(2,2,"GUESSING GAME
:Output(5,1,"PROGRAMMED BY
:Output(6,3,"TI-BASIC WIKI

Enter Own Numbers

:Output(2,1,"ENTER NUM 1
:Input ":",A
:Output(4,1,"ENTER NUM 2
:Input ":",Z

Select Level of Difficulty

:Input "Range - 1 to:",Z

Both of these should be followed by the random selection of the number, using the following code:

:Lbl 1

We then let the user guess, and give them feedback on whether their number is correct or not, and whether it's too high or too low.

:Lbl 2
:Input ":",Y
:If X=Y:Then
:Goto 4
:Goto 3
:Lbl 3
:If Y>X:Then
:Disp "TOO HIGH"
:Goto 2
:If Y<X:Then
:Disp "TOO LOW"
:Goto 2

Then, we create a screen that tells the user that they are correct and then sends the beginning.

:Lbl 4
:Output(2,1,"YOU GOT IT RIGHT
:Goto A

This program is a great way to start testing your abilities with programs that use advanced mathematical procedures (such as Fighting RPGs). You can make your program better by adding things such as:

  • Creating a number of guesses the user must guess the answer in (HINT:Add another If/Then command and variable)
  • Giving a hint option to the user (HINT: Set for specific number of guesses)
  • Give your "YOU GOT IT RIGHT" screen a little animation

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.