The basic programming language on the TI-84 graphing calculator is an excellent starting point for aspiring programmers. Even if one isn’t a logic guru, this manual is designed to guide the student who has used the TI-84 in class for graphing and simple calculations to a linear word quest. The foundation for creating a unique adventure comes from knowledge of basic loop structure and variables, so these two topics will be covered briefly to encourage understanding of how the provided template (Figure 4) works.
Variables are essential to creating a text adventure. Most students are familiar with the X,T,θ,n button for inserting the variable X into a function that will be graphed. There are 26 other variables that can be used by pressing ALPHA then choosing a button corresponding to the desired green character. To store a value to a variable, type an expression then press STO> and the variable. A great way to experience how variables work is to try typing in the following commands from the home screen of the calculator (the buttons pressed for each line are shown to the right):
The variable X is obtained by pressing the X,T,θ,n button and the variable X obtained by pressing ALPHASTO> share the same value.
Figure : Using Variables
Make sure your calculator’s functions are in rectangular form (Y1=, Y2=, …), or the variable produced by X,T,θ,n will be one of the non-X variables.
WHILE LOOPS AND DISPLAY
While loops are powerful tools for doing something repeatedly as long as a statement is true. These loops begin with :While(*statement*) and always end with :End (colons depict the beginning of a new line in the coding). The statement has asterisks surrounding it to indicate that you can insert anything, and in this case it must be true or false. :Disp(*expression*) tells the calculator to show the value of an expression on the home screen. If only a variable is given, the value of the variable is displayed. :Disp(“*enter words here*”) will show any text as long as it is between quotation marks and less than 16 characters. To see how these work in conjunction with each other, open a new program (by pressing PGRM, scrolling over to NEW, pressing ENTER and entering a title) and try the following:
:Disp(“*Message*”) will truncate your message to the first 15 characters with an ellipsis if it is longer than 16 characters (the horizontal capacity for the screen). An easy way to verify that a message is shorter than this limit is to check if any of the message’s characters are directly above another in the line of code. Use another display line if necessary.
PAUSE AND CLRHOME
To stop a code from continuing until the user presses enter, add the line :Pause to the code. It is found under PRGM8. With a combination of this line and :Disp, one could write a story by displaying seven lines, pausing, and repeating with different text to the heart’s content. On the other hand, :ClrHome is typically an aesthetic addition; this line empties the home screen of all visuals and text. Many programs open with this line to remove unwanted text on the screen. It is found at PRGMI/O8.
The difference between a text adventure and a story is that text adventures require user input. :Prompt X will ask the user to input a number to be stored as X. This line allows for multiple pathways in a story to create the most basic text adventure when used in conjunction with while loops. See Figure 3 for an example on how to use the prompt command in an actual adventure.
:Disp(“YOU’RE IN A CAVE”)
:Disp(“AND FIND A FIRE-“
:Disp(“WHAT WILL YOU“)
:Disp(“(1): HIT IT WITH”)
:Disp(“YOU ESCAPE AND”)
:Disp(“CHOW DOWN ON”)
--The apostrophe is found under 2NDAPPS2.
--To lock in ALPHA for faster text-typing, press 2NDALPHA. To exit this mode, press ALPHA.
--“!” Is found under MATHPRB4.
--Blank lines of code may make sections easier to recognize when looking at them later. These lines have no effect on the program.
-- the lines “:3->X” and “:4->X” are intended to escape infinite loops. Any value other than 1 or 2 will work.
To add more depth to this adventure, try adding more code to the end with “:While(X=4)” and more sections with multiple options. When running into errors, try referring to the compositions of previous sections. Figure 4 is a template based on the code from Figure 3.