Disaster

…that you can use tanh(E9X to compute the sign of X?

…that Line( has an optional fifth argument that, if zero, will erase the pixels on a line, and, on color calculators, will change the color of the line?

…that you can replace the "Done" message that appears after a program is finished running by placing an expression, some text, or just a quote on the last line of your program?

…that you can use rand( to create a time delay similar to the Wait command on the TI-84+CE?

…that you can use multiple text arguments at the end of one Text( command to write, for example, Text(R,C,"Score",S)?

…that you can draw with different plot marks using Pt-On(X,Y,#)?

…that you can save memory when displaying text by replacing words such as "If" and "Then" with the appropriate commands?

…that "0<X<10" will actually compare "0<X" first, and compares the result (0 or 1) to 10, so "0<X and X<10" should be used instead?

…that using ΔList( together with cumSum( will return a list with its first element removed?

…that there are 256 picture variables built-in to the TI-83+ calculator, even though the calculator only shows 10 picture variables?

…that you can enable the faster circle drawing flag on the TI-83/84/+/SE by placing {i after the last argument of the Circle( command?

…that you can get the home screen font on the graph screen (except on the regular TI-83) by placing a '-1' at the beginning of the Text( command?

…that you can get the number of digits of a number N to the left of the decimal point by using the formula 1+int(log(N)?

…that the smallest way to implement the distance formula is by using the R►Pr( command?

…that you can use the % symbol or sub( with one argument as a smaller replacement for multiplying by .01?

…that you can get rid of the run indicator on the TI-83/84/+/SE by using Text(-1,0,90," " on the graph screen and Output(1,16," " on the home screen?

…that you can run your TI-Basic program from an assembly shell by placing a colon (":") as the first line of your program?

…that you can store to the list element one past the last element to add it to the end?

…that the finance variables are the fastest variables to use, even faster than Ans?

…that the String►Equ( command is completely useless, and you can store a string into one of the equation variables just using the → (store) operator?

…that the fastest way to check for a whole number is the command not(fPart(?

…that you can compress a list of related numbers by combining them into integer and fraction parts?

…that the majority of the graphics commands are dependent upon the window dimensions, so you should always use a friendly graphing window to ensure everything shows up as you intended?

…that you can make subprograms that are contained inside the program itself, so that they can be called by the program whenever needed?

…that you can use SetUpEditor to UnArchive a list, but at the same time create the list if it doesn't exist?

…that you can get away with not having a colon or a new line after DelVar?

…that placing a Lbl after DelVar will make that Lbl literally disappear?

…that you can scroll the Pause command's optional argument to see it in its entirety?

…that the smallest (though not the fastest) way to shade the entire graph screen is Shade(Ymin,Ymax)?

…that pressing alpha in the program editor followed by up or down, you will scroll a whole page of program code?

…that pressing [2nd] [RIGHT] in the program editor will take you to the end of your current line, and [2nd] [LEFT] will take you to the beginning of that line?

…that TI added several new TI-Basic commands to the newer TI-84+/SE calculators?

…that you can use -E99 and E99 to represent -∞ and +∞ in many calculations?

…that a memory leak is caused when you use a Goto/Lbl within a loop or If conditional to jump out of that control structure before the End command is reached?

…that a Repeat loop will always loop at least once, regardless of whether the condition is true or false before entering the loop?

…that the arrow and DEL keys can actually be held down, which will cause the key to keep being repeated until it is released?

…that the key codes follow a simple pattern: a key is represented by putting its row and column together?

…that you can access the lowercase letters by using an assembly program to turn on the lowercase flag that the calculator uses for enabling lowercase letters?

…that the Horiz format will split the screen in half horizontally, with both the graph screen and home screen being shown at the same time?

…that the expr( command allows you to store an expression to a string and then execute the string?

…that the TI-83 series of calculators does implicit multiplication, so there is no need to ever use the * sign?

…that iPart( and int( will return the same answers for positive numbers, but int( will return an answer 1 less than iPart( for (non-integer) negative numbers?

…that lists are the only variable that you can give your own names to?

…that you can omit the closing parentheses, quote, square bracket, curly brace, etc. at the end of a command or function?

…that Finance under the Applications menu is really not an application at all?

This is the page that allows you to add a did you know to the home page of each section

83 Portal 68k Portal Nspire Portal 83 and 68k Only All Models
Add a DYK Add a DYK Add a DYK Add a DYK Add a DYK

Challenge ? — No title given

No criteria given

Entries judged on the ?/?/?


[{$forum_url} Challenge {$number} — {$title}]

{$criteria}

Entries judged on the {$day}/{$month}/{$year}


Name: Pong Contest
Author: Mapar007
Download: thpong.zip
Compatibility: Parent page not set
File Size: 669 bytes
A simple game of "Pong"
Name: Trapped
Author: builderboy
Download: Trapped.zip
Compatibility: Parent page not set
File Size: 13,932 bytes
You wake up to find yourself trapped in the center of a fiendish maze filled with mystery and enemies that want to eat you. A mysterious friend and long forgotten notes guide you through the maze. Find items, blow up walls, fight logical enemies, and above all, find the machine that will help you escape.
toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it. {$extra}
toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it.
toolbar-separator.png Note that this page was written in 2009, and much of the content may be outdated. For now, it is recommended that you visit the Nspire forums if you have questions. Or see the TI Nspire Software Manual for full documentation. UPDATE: You can now visit the Nspire home page

The TI-Nspire is a unique calculator in the BASIC series. The calculator's programming system is remarkably similar to that of the 68k's hardware, but because the Nspire's internal core is different, it needs a section on its own. Unlike all the older TI versions, the Nspire does not have a home screen or a graph screen. Instead, the calculator runs on a document that has five applications: Calculator, Graph and Geometry, Spreadsheet, Notes, and Statistics. The programming operates under the Calculator application. Although the Nspire makes good use of form and screen resolution, the programming is very limited compared to older versions. This article is meant to give you a brief overview of the programming in the Nspire and how older versions are preferable if you want to program.

The Nspire: Introduction

The Texas Instruments Nsipre is an upgraded version of all the other TI models. It uses very much the same type of formatting as the 89 family but does not have a CAS. When first observing the calculator, you will notice the keypad. It is highly different from any other calculator.

Image not Available

It has a very strange layout compared to the other TI graphing calculators. First, all the letters get their own buttons, making it a little easier to type. Also, it has a ctrl key rather than a 2nd key. It has a clicker key, menu key, catalogs, enter, and even a caps key. If you observe it long enough, it begins to resemble a keyboard. This is because the Nspire is designed to be like a computer in a way. It uses documents to store information. These documents hold information about anything you did within it, not just programs. You can choose to save it, or load different documents, a lot like a computer. Also, the Nspire utilizes a mouse type system. It replaces the arrow keys with one round button. It acts as the arrows, and as a way to move a mouse-like pointer across the screen. The Nspire is a transition of a calculator to a computer, yet held back enough to retain calculator status.

The second thing you would notice is the screen resolution. Very nice! The screen is much better than any other calculator in history. The screen displays curves very well, it graphs cleanly, it uses letters and other characters with different size (much like a computer font style), and it is bigger. Also, the screen has many different shades of gray. In using inequalities, the calculator can actually shade in the region instead of drawing lines that represent it, and it darkens regions of overlap. The screen is very nicely done.

The final most notable thing is you might get lost on where every function is. The calculator has a very different key layout, and it also has a different internal layout. You might have trouble finding where some of the functions are. This article does not discuss how to find different functions, but it discusses the programming attribute which is the main topic of this site. For finding various functions, visit the Catalog (the book button) or check your CD manual. It has loads of information you can use.

Pros and Cons

The programming for the Nspire is very similar to the 68k series. However, the Nspire simply isn't part of it. For one thing, the Nspire has no graph screen, or even a home screen. Everything is formed with documents, problems, and pages. You can have a document, problems within that document, and pages within those problems. Even though everything within a document is connected in some way, the calculator doesn't seem capable of accessing other pages or problems without manual control. Because of this limitation, the calculator has no graphing commands. It lost commands like Pt-On( and Line(. Anything under the Draw category has been deleted. The Draw command was the basis of advanced graphics, so that means the Nspire cannot produce any games with any sort of graphics, even though its resolution is so many times better than that of older models.

Furthermore, the calculator has no home screen. Instead, it uses a very strict line by line layout. The calculator deals with an operation or command very systematically. Until the calculator completes an assigned command or operation, it will not let the user interfere. New inputs are automatically in a new line. This sounds a lot like other calculators completing operations without interruption. However, this becomes a huge problem when pertaining to programs. The Nspire does the same thing to programs; it doesn't allow user interference. That means that the calculator will not accept user input until the program is finished. That defeats the purpose of programs. If you can't input anything, what use is programing? It happens that the program accepts input before a program is executed, but not during. So, to make a program with the same effects of programs in 68k or 83 family BASIC, you have to create multiple programs that must each be individually accessed, which becomes incredibly cumbersome.

So, the calculator is terrible at programming. It can't produce graphics or advanced layouts, and it won't accept input. So what use is programing on an Nspire. Truthfully, if you want to program, don't get the Nspire. Simply put, there is no real way to work around these obstacles. However, the regular Nspire comes with an 84+ keypad. It has all the capabilities of a regular TI-84+. Thing is, even though the calculator has capabilities of using extreme resolution, the 84+ keypad doesn't utilize it. So it's still not all that good.

So what if I already have an Nspire? Don't worry. If it comes with the 84+ keypad, go ahead and use that to program. In any case, the Nspire is definitely superior in math. Through sacrifice of programing capabilities, it has gained many useful math tools. For example, it checks primes, has trigonometric functions like secant and cotangent, a newly optimized numerical solver, point plot er, geometry grapher, spreadsheets, and more. It even utilizes templates, so instead of writing a math equation like ((3+4)/(5(6+3))^4, the calculator can write it as $\left( {3+4 \over 5(6+3)} \right) ^4$ instead. The Nspire also can hold numbers way higher than 1E100. So, it is superior in math (which can be a real big help on math tests!), but not a good programming apparatus.

This article will further discuss the topic of programming on an Nspire calculator describing how to create programs, describe all the commands, ways to get input, ways around the major obstacles, and a game example in the end.

Creating a Program or Function

To create a program, make sure you are in the Calculator application. Press Menu and go to 8. Then, press 1 and 1 again. A window will pop up prompting the name of the program. Put in the name, select the type (program or function) and press OK. Now, you are in the program editor and you can now create your program.

There is are differences between programs and functions. Depending on what you are doing with the program, you will want to select one of them.
Program Function
Return a result? No Yes
Can be used in an expression? No Yes
Can run in applications other than Calculator? No Yes
Can use all the commands? Yes No
Can use multiple variable types? Yes Yes
Can access global variables? Yes Yes
Can modify and create global variables? Yes No
Can call subprograms? Yes No
Can call functions? Yes Yes

A program is what the other calculators typically use. The function can be used inline in an expression, such as 5+func(7)-2. However, functions do not support most of the commands on this page.

Format

The format of the TI-Nspire is a little more organized than the 83 series. The program editor keeps much the same format except it indents for every group of commands. For example, it indents If…Then blocks, While…EndWhile blocks, and others.

Define test(a,b)=
Prgm
If a=1 Then
…Disp 1
c:=5
ElseIf a=2 Then
…Disp 2
…While b>0
……b:=b+2c
……Disp b
…EndWhile
ElseIf a=3 Then
…Disp 3
EndIf
EndPgrm

Variables on the Nspire function in much the same way as 68k variables. A variable can be a string of letters. An undefined variable is italicized. For example, if the variable height was undefined, or had nothing stored to it yet, then on the calculator the variable would look like height. Defined variables are bolded, so if height was defined, it would appear as height. Commands are neither bold or italicized, and you cannot store information into them.

Execution

To execute the program, go to the Calculator application. You must then type out the entire program name. Then, put parentheses with values that must be defined for the program within them. The syntax for the above would look like:

test(2,-3)


You could also select the program from the var button.

The Commands

Most of the commands on the Nspire are the same or variations of the 68k commands. However, the Nspire lacks most graphical commands, and some variable commands are limited. Some commands require a Computer Algebra System, or CAS, so if your Nspire doesn't have CAS, many of the commands will not function.

There are a few commands for exclusive use in programming. These commands help direct how the program works so that it can complete various tasks. The commands are divided into categories based on their overall function.

Define Variables

These commands have to do with the variables. Commands listed here will affect the way the program treats variables.

Local

Local is a command that tells the calculator how to identify the variable that comes after it. Local tells the program to make the variable a temporary variable that only functions within the program itself. So, when you local a variable, that variable is only used within the program, and if that same variable is used anywhere else, you will find that it was not affected. Here is the syntax.

Local varname


The varname can be any variable name or type. This command is useful in the sense that it won't mess with your previous usage of the variable. If you want to use the variable name, but it is used in other programs and you don't want your program to mess it up, use local. If there is a case where you want the variable to be altered globally, then don't use local, and the calculator will treat it like any other number.

Define

The command Define will allow you to use subroutines within a program. This command creates a new program or function within the program so that the subroutine can be used again. For it to work, you must have either Pgrm…EndPgrm or Func…EndFunc for it to work.

Define test2(x,y)
Pgrm
Disp x,y
EndPgrm

Delete Variable

This command will delete a variable making it undefined. This command will not set a number equal to 0, but it instead changes the variable to become unusable until defined later with a store command.

DelVar height

This command would be good to use when cleaning up a program. If you don't want your variables to have values after a program finishes, use DelVar to reset the variables.

Func…EndFunc and Pgrm…EndPgrm

These sets can be used to create subroutines when used with Define. Func…EndFunc will create a function whereas Pgrm…EndPgrm will create a program. Use these after a Define in order to create the program which can be defined later in the main program.

Define test2(x,y)
Pgrm
Disp x,y
EndPgrm

Control

These are the main commands that will be used. The control commands control the flow of the program affecting what group of commands to activate or how many times to commence a group of commands.

If

This is exactly like the If condition used in other BASIC languages. You put a condition after the If, and if the condition is true, the next line will be executed. If it is false, it will be skipped. Here is the syntax.

If height>0
height*widtharea

This is very, very useful in programming, if not essential. The If command makes games possible. It detects limits, exacts, and special circumstances, which can affect the reality of any program.

If…Then…EndIf

In BASIC, this is the equivalent of the If:Then combination. A condition goes after the If. If the condition is true, everything after the Then until the EndIf will be executed. If it is false, the calculator will begin at the EndIf and execute those commands. Here is an example.

If h=3 Then
…3+3→a
a+hc
c/h+ah
EndIf
Disp h


In this example, if h is 3, then the number displayed will be 9. If h isn't three, then it will display any number that is not three. Again, this conditional command is highly valued in programming. This is a must in programming! This also determines limits and special instances, but this opens a new field of the programing.

If…Then…Else…EndIf

We probably don't need to tell you that this is the same as in BASIC. In this, it is an If conditional followed by Then and Else. If the condition after the If is true, then everything after the Then will be executed, but everything after the Else will be skipped. If the condition was false, then everything after the Then is skipped, and everything after the Else is executed. Here is an example.

If a>b Then
…Disp "Yes"
Else
…Disp "No"
EndIf


In this code, if a is greater than b, the program will say "yes", otherwise, it will say "no". This command is very useful. It is an efficient way to test something, and then have the program do one thing or the other depending on its fallacy. This command control is a very good way to maneuver your program, and it is highly recommended that this be used.

ElseIf…Then

This is a special form of the If…Then…Else…EndIf command. This command allows you to test multiple different options instead of only one. This command must come after an If…Then, and you may have a lot of ElseIf's. First, it will test if the first condition is true. If it is, everything after Then is executed, and the program goes to EndIf at the first ElseIf it encounters. If it is false, the condition after the next ElseIf is tested. It does this until all ElseIf conditions are tested or one is true, and the following commands are executed.

If a=1 Then
…Disp "a is one"
…4→c
ElseIf a=2 Then
…Disp "a is two"
…2→c
ElseIf a=3 Then
…Disp "a is three"
…8→c
EndIf

This code tests the value of a three times. First it finds if a=1. If it does, the text "a is one" will appear, and c will become four. Then, it proceeds after EndIf. If a is not one, then the next condition a=2 is tested. If a is two, then the text "a is two" is displayed and c becomes 2. This is how the ElseIf works.

The ElseIf is a lot like the If…Then…Else…EndIf. These two codes are the same.

If a>6 Then
…2h+3→c
a+2-hd
…Disp "Next move?"
Else
…Disp "You Lose"
…Stop
EndIf

If a>6 Then
…2h+3→c
a+2-hd
…Disp "Next move?"
ElseIf a≤6 Then
…Disp "You Lose"
…Stop
EndIf

For…EndFor

This is a calculator loop. This command, when used as For variable,start,stop,optional increment, will start with start, store that into variable, and execute every command until it reaches EndFor. Then, the program will go back to For, and add optional increment to variable and does do until it reaches the number stop. After that, it will end the loop and start executing commands after EndFor. The optional increment is an optional input, and the program will assume it is 1 unless stated otherwise. Here is an example of a For loop in action.

For a,1,11,2
…Disp a2
EndFor


This code will display 1, 9, 25, 49, 81, and 121. This is because it starts with a as 1, then a as 3, then a as 5, and so on.

While…EndWhile

This command is another type of loop. This loop requires a conditional after While. It loops for as long as that condition is true, and the loop ends when that condition becomes false. For the loop to be executed, the condition must initially be true. Also, make sure the variables within the condition change otherwise the loop will become infinite.

0→x
While x<5
…Disp x
x+1→x
EndWhile
Disp x


This loop will display 0, 1, 2, 3, 4, and then 5. The loop ends when x becomes 5, and it displays the numbers from 0 to 4 because the starting number is 0. While loops are essential to game creating or animation.

Loop…EndLoop

This command creates an infinite loop. This type of loop requires no arguments and will not stop unless you insert a Stop, Exit, or Goto. To exit the loop, it is best to create conditionals within the loop to signify when to jump out of the loop.

0→x
Loop
…Disp x
x+1→x
…If x>5
…Exit
End
Disp x


This code displays the same thing as the While…EndWhile loop above. The only real difference is that with Loop…EndLoop, you can create a conditional within the loop where the While…EndWhile only checks the conditional at the EndWhile.

Try…Else…EndTry

This command allows you to literally "try" a group of commands, and if they error out, the ones after Else are commenced. If an error occurs in the Try part, then the calculator recovers from the error and picks up at the Else.

DelVar b
Try
…6+bc //note that b is undefined
Else
…6+7→c
End
Disp c


The program displays 13. The program first needs to try 6+bc, but since b is undefined, the program errors. However, since it is in a Try block, it skips to the Else and tries 6+7→c which works. So, it displays c which is 13.

ClrErr

This command clears the current error and sets the error system variable to zero.

PassErr

PassErr will pass an error to the next level of a Try…EndTry block.

Transfers

The transfer commands direct what a program does without the need of an input. These commands simply activate when executed and tell the program specifically what to do.

Return

This command will exit out of a subroutine and progress directly back to the parent program.

Cycle

The Cycle command acts like an early End in the program loop. When encountered, it immediately shoots back to the beginning of the loop. When the loop ends, it doesn't go to Cycle, but it instead goes to the correct End.

Local a
0→a
While a<10
…Disp a
a+1→a
…If a>5
…Cycle
a+1→a
EndWhile


This code displays 0, 2, 4, 6, 7, 8, and 9. What happens is a+1→a occurs twice thus making a+2→a. However, when a becomes greater than five, the second a+1→a does not occur because the Cycle makes the loop restart.

Exit

This command will immediately exit the current loop you are in. So, it stops the loop and starts where the End is. This command is used to escape Loop…EndLoop's, but it can be used with For…EndFor and While…EndWhile. It requires no arguments.

0→x
Loop
…Disp x
x+1→x
…If x>5
…Exit
End
Disp x

Lbl

This places a Label in a program. A label is like a flag or marker in a program that can be used as a location by which a program can go to using goto. Labels have a name after them, like Lbl here, When the program encounters a goto name, it starts looking for the label with that specified name. When it does, the program resumes at that point.

Go to Lbl

This will create a Goto in the program that will send the program out to find the matching label. This can be used to jump entire sections of the program or be used as a loop.

Local a
randInt(1,2)→a
If a=1
Goto 1
Disp "Heads"
Stop
Lbl 1
Disp "Tails"


This is a simple coin program that uses Goto. First, a random number is stored to local variable a. If a is 1, then it is tails. The program encounters Goto 1 and so it goes to Lbl 1. From there, it finishes the program. If a is two, then Goto 1 isn't encountered, so it displays the Heads and stops.

Stop

This command halts the program. That is all it does. When the program encounters this command, it will completely end the program wherever it is.

3:=a
Stop
Disp "How did you get here?"


This code stores 3 into a and ends. The code will not give any output at all. This is useful when you reach a point where the user inputs and ending command (other than ON) so you can use an If type statement to end the program immediately. Then, you can put stuff after it in case the user did not want it to stop. Stop is also redundant at the end of a program.

I/O

Disp

This command displays whatever comes after it on the screen. This is what you see when you run a program; it is what the calculator produces as a result of the internal commands and calculations. Simply, put whatever you want to show after the Disp. If you use quotations, it will display the literal text. If there are no quotations, then the calculator will attempt to solve the expression you put.

Disp ab+a
Disp "Hello"


This code will display the answer to ab+a and then display "Hello" after it. This command is needed unless you aim for the program not to tell the user anything. So use this command, because it is the only way to convey a message to the user.

Request

Syntax: Request promptString, var[, DispFlag [, statusVar]] or Request promptString, func(arg1, …argn)[, DispFlag [, statusVar]]
Request gets numbers from the user. It pops up a dialog box with a message of your programmed choice. For example, a little program snippet:

Define reqprog()=
Prgm
Request "Enter a number:",number
If number=1 Then
(code)
EndIf
.
.
.
EndPrgm

RequestStr

Syntax: RequestStr promptString, var [, DispFlag [,statusVar]]
Almost same thing as Request, but requests a string.

Define yourname()=
Pgrm
RequestStr "What is your name?",name
Disp "Hello, ",name
Disp "Your name is ",dim(name)," characters long."
EndPrgm

Text

Syntax: Text promptString [, DispFlag]
Pops with a dialog box with a message and an OK button.

Define randprgm()=
Prgm
For i,1,5
strinfo:=”Random number “ & string(rand(i))
Text strinfo
Next
EndPrgm

Mode

The mode commands are the ones that change the overall output and computing system of the calculator. This includes changing things from degrees to radians, and from rectangular to polar. Under normal circumstances, these commands would probably not be used unless you are making a math program.

Gaining Input

Getting user input on the Nspire is rather difficult and highly limited. The main problem is that the only I/O command is Disp. Unlike the TI-83 series or 68k, the Nspire doesn't have Input, Prompt, or getKey. The lack of these three commands makes the programming fairly weak on the calculator even though it has dozens more capabilities. Rather, what TI has done, is they expect the user to input the variables before program execution, and that is typically the one and only way Nspire programs will receive input. The problem becomes the user not knowing what he/she is inputting.
With updates to the Nspire OS, Request and RequestStr have been added to the command list, which enables the input of data during program execution. Input is still limited, as you cannot build a menu as in the TI-83/84 series. In internal commands they have I/O message boxes (wizards) with scroll lists and multiple input for a command; unfortunately TI has not enabled the programming of such dialog boxes.

There are three ways to receive input. The first way is to simply have the user store desired values into all the variables before executing the program. For example, say that a program uses the variables width and height. The user can store what he or she wants to be the width or the height by using the syntax valueheight. If there is already something in the variable, then it would look more like valueheight. Then, the user can execute the program.

The second way exists within the reason for the ending parenthesis during execution. In the program editor, the programmer can go to the top line where the Define Program() is. Then, you put the variables you want defined in the parenthesis separated by commas. So, still using width and height, the top line would look like: Define Program(width,height). Then, the user types out the program name with the parenthesis, but instead of leaving the parenthesis blank, the user would put the values he wants to assign width and height in the parenthesis separated by commas.

The final way is a way to get input during a main program. Unfortunately, the only way to receive input mid execution is the completely stop the program and let the user activate another program (or the same one) with the new values. This of course is not all that user-friendly. It can also be frustrating having to redefine a program every time.

Programming

In truth, the only real application for programs is the use of math and probability programs. Although the thought of games is conceivable, it would be futile to even attempt making something even like pong or another simple game. Even creating a guessing game is almost impossible. Even so, programming does have the application of helping you with your math or giving you an idea of likelihoods.

Math Programs

Making a math program can be pretty useful. These programs are the ones that ask for an input and begin solving. This can be easy to program because most math programs only require one input at the beginning. One such program would be a quadratic equation solver.

To make a math program, you must first determine what you are solving for and what variables are being given. For our quadratic equation solver, we want the two roots, determinant, and vertex when inputting a, b, and c when ax2+bx+c=0. The user must input a, b, and c at the beginning of the program. Since that is the only input, this can be done easily. Define the program and put the variables within the parentheses.

Define quadratic(a,b,c)
Pgrm

EndPgrm


The next step is to plug in your formulas. We want the calculator to solve for the roots with one special condition: For two roots, it must display both roots and "Two Solutions", for one root, the answer and "One Solution", and when both roots are complex to display a solitary "No Solution". We must first find the determinant which will tell us how many solutions will result.

Define quadratic(a,b,c)
Pgrm
b2-4a*cd
EndPgrm


Now, we can add our conditionals with If…EndIf blocks.

Define quadratic(a,b,c)
Pgrm
b2-4a*cd
If d>0 Then
…Disp "Two Solutions"
…Disp $-b+\sqrt{d} \over 2a$
…Disp $-b-\sqrt{d} \over 2a$
EndIf
If d=0 Then
…Disp "One Solution"
…Disp $-b \over 2a$
EndIf
If d<0
Disp "No Solutions"
Disp "Determinant"
Disp d
EndPgrm


That finishes the program.

Probability Programs

This is probably the most conceivable types of programs you can make on an Nspire. This would be the type of program where you experiment to define the likelihood of occurrences under certain conditions. This would be like spinning a spinner 1000 times or flipping a coin 25 times. These programs are easy to make because all you need is a random command and a For loop. For this program, we are going to say we need to spin a spinner 100 times where the blue section has a theoretical probability of 0.5, the yellow 0.25, and the red 0.25. First, define your program. The user doesn't need any variables defined, so we will just close the parentheses on the first line.

Define spinner()
Pgrm

EndPgrm


Now, we want to define our variables within the program, so we need to local them. We want our variables to be named blue, red, and yellow. Also, initialize them.

Define spinner()
Pgrm
Local blue
Local red
Local yellow
0→blue
0→red
0→yellow
EndPgrm


Next, we need to start the For loop. Since we want 100 trials, we will start at one and end at 100.

Define spinner()
Pgrm
Local blue
Local red
Local yellow
0→blue
0→red
0→yellow
For a,1,100

EndFor
EndPgrm


Now, use randInt() to find the color landed on. Since we are dealing with fourths, use numbers 1 to 4.

Define spinner()
Pgrm
Local blue
Local red
Local yellow
0→blue
0→red
0→yellow
For a,1,100
…randInt(1,4)→spin
EndFor
EndPgrm


Next, we need to set up each conditional so that if the variable spin is 1 or 2, blue goes up one, if it is 3, yellow is incremented, and if it is 4, red is incremented. We can use the ElseIf commands for this.

Define spinner()
Pgrm
Local blue
Local red
Local yellow
0→blue
0→red
0→yellow
For a,1,100
…randInt(1,4)→spin
…If spin<3 Then
……blue+1→blue
…ElseIf spin=3 Then
……yellow+1→yellow
…ElseIf spin=4 Then
……red+1→red
…EndIf
EndFor
EndPgrm


Now, the last step is outputting the results. Simply create a list of displays to show the number of spins.

Define spinner()
Pgrm
Local blue
Local red
Local yellow
0→blue
0→red
0→yellow
For a,1,100
…randInt(1,4)→spin
…If spin<3 Then
……blue+1→blue
…ElseIf spin=3 Then
……yellow+1→yellow
…ElseIf spin=4 Then
……red+1→red
…EndIf
EndFor
Disp "Yellow"
Disp yellow
Disp "Blue"
Disp blue
Disp "Red"
Disp red
EndPgrm

Game Programs

The game program is very hard to accomplish in Nspire Basic. These types of programs will usually take more than one program to accomplish in order to accept more user input. However, a game such as "Guess my Number" can be done in one program.

The general strategy is to create a starter program that sets up the game. Then, every time user input is required, separate it into another program and leave a display telling what the next program is. For one program, initially start a global variable with a strange name so the program can recognize if you are starting a new game.

Here is a game where you have to guess a number between 1 and 100 in seven tries. First, you need to create variable gmn as 0. This variable will be our deciding number that finds what try you are on and whether a new game starts or not.

Create the program. Variable a will be the user guess.

Define guess(a)
Pgrm

EndPgrm

Define what happens if gmn is 0. The program stores a random number between 1 and 100 into b. Then, 1 is stored into gmn to represent guess 1.

Define guess(a)
Pgrm
If gmn=0 Then
…Disp "Guess a number between 1 and 100"
…Disp "Type guess( ) with the guess in the parentheses"
…randInt(1,100)→b
…1→gmn
…Stop
EndIf
EndPgrm

This next part says that if your guess, a, is larger than b to display guess lower. If it is smaller, guess larger. If a is equal to b, then it displays "You Win!" and the gmn resets to 0.

Define guess(a)
Pgrm
If gmn=0 Then
…Disp "Guess a number between 1 and 100"
…Disp "Type guess( ) with the guess in the parentheses"
…randInt(1,100)→b
…1→gmn
…Stop
EndIf
If a>b Then
…Disp "Lower"
ElseIf a<b Then
…Disp "Higher"
ElseIf a=b Then
…Disp "You Win!"
…0→gmn
…Stop
EndIf
EndPgrm

Finally, the program will check if you won or not. If the gmn variable (our turn keeper) goes higher than 7, the program ends and gmn is reset to 0.

Define guess(a)
Pgrm
If gmn=0 Then
…Disp "Guess a number between 1 and 100"
…Disp "Type guess( ) with the guess in the parentheses"
…randInt(1,100)→b
…1→gmn
…Stop
EndIf
If a>b Then
…Disp "Lower"
ElseIf a<b Then
…Disp "Higher"
ElseIf a=b Then
…Disp "You Win!"
…0→gmn
…Stop
EndIf
gmn+1→gmn
If gmn>7 Then
…Disp "You Lose."
…Disp "Answer was"
…Disp b
…0→gmn
EndIf
EndPgrm

A Game Example

This game, called FighterX, is a test against the calculator to see how well of a guesser you are. It is a relatively simple program where all the user does is guess a number from 1 to 3. If you guess the number the calculator was thinking of, the calculator loses HP. Otherwise, you lose HP. Try to understand the code.

Program 1

Define fighterx()
Pgrm
100→you
100→calc
Disp "Are you ready?"
Disp "Type gs( ) with your guess in the ( ) to begin"
EndPgrm

Program 2

Define gs(g)
Pgrm
randInt(1,3)→gc
If g=gc Then
calc-randInt(5,13)→calc
Else
you-randInt(2,7)→you
EndIf
Disp "You"
Disp you
Disp "Calc"
Disp calc
If you<1 Then
…Disp "You Lose"
…DelVar you
ElseIf calc<1 Then
…Disp "You Win!"
…DelVar calc
EndIf
If you>0 and calc>0
Disp "Type gs( ) and guess again"
EndPgrm

Break a Calculation

The Nspire version of the ON-Break is a little different than for the 83/84 series. For the Nspire, you must press and hold the On button and wait until it asks for confirmation. Then, you can break the calculation. This is useful in the event that an overly complicated function is being performed and you want the calculator to stop thinking so that you can do something else, without having to reset the calculator or remove batteries.

Forum

To visit the TI-Nspire forum, click here. If you have any questions about the Nspire programming or calculator itself, please ask in the forums, and someone will help you as soon as possible.

Further Research

You can discover much about the Nspire and its commands through the 68k portion of this site since they are quite similar.

This is where most of the magic happens, be it for math class or a game. While much can be accomplished on the Home Screen, it's nowhere near as versatile as the Graph Screen.

Introduction

The most useful aspect of the Graph Screen is the variety of ways to create graphics. There are 95x63 adjustable pixels that can be modified with any of the Pxl-, Pt- or more specialized draw commands as well as a twist on Text. Unlike on the Home Screen where your coordinates are restricted to integers from 1-8 and 1-16, different window settings can be used to customize the coordinates of each point. You can switch points between 'on' and 'off', or just check to see if a point is 'on' (great for collision detection!).
(NOTE: The TI-84+ CSE and CE have a bigger screen, so the pixel dimensions are 320x240. However, the adjustable pixels are 264x164 (X by Y). Keep those last dimensions in mind when you program for either the CSE or CE calculators.)

Pictures

Pictures include anything that can be created on the Graph Screen from the Draw menu, but not any functions or graphs.

StorePic

StorePic allows you to save the current picture from the Graph Screen and can be accessed from the STO sub-menu
by pressing [2nd][Draw][Left][Enter]. This can be useful if you have a frequently used picture or a background that you don't want to have to continuously redraw. Within TI-Basic there are 10 picture variables, which are numbered 0 through 9.
For example, if you wanted to store the current picture to Pic1 you would do:

:StorePic 1

RecallPic

RecallPic is used to display a previously saved picture. It can also be found in the STO sub-menu. The one thing to remember when using this command is that it will draw the picture on top of what is already on the Graph Screen instead of completely replacing it. This means that it will turn on any pixels that are on in the picture, but will not turn off pixels that are off in the picture. An easy way to circumvent this is to use ClrDraw before recalling the picture.
If you wanted to display Pic1 you would do:

:RecallPic 1

Graph Databases

A Graph Database contains the window and format settings, functions, and the settings of FUNC/PAR/POL/SEQ, CONNECTED/DOT, and SEQUENTIAL/SIMUL from the Mode menu.

StoreGDB

Just like with StorePic, StoreGDB is used to store the current graph database settings. It can be found in the STO sub-menu. There are 10 GDB variables, which are numbered 0-9.
To store to GDB1 you would use:

:StoreGDB 1

RecallGDB

Incredibly, RecallGDB is used to recall a saved graph database! Luckily this does not have the problem of RecallPic. If one setting has a value that's not the same as the saved value, then it's changed to the saved value.
To recall GDB1 you would use:

:RecallGDB 1

Things To Come

In the following sections of this chapter you'll learn different ways to manipulate pixels, how to use the various draw commands and the effects that 'simple' text can have in order to create truly awesome games!

<< Sample Program: Chase the Star Table of Contents Drawing Points and Pixels >>

When you compile a basicbuilder app, any delvar command will not delete the variable. But, there is a way to delete the variable using two assembly programs celtic2 and Zrun. First you have to specify all of your delvar commands in Str9 like:

"Delvar ADelvar BDelvar C"→Str9

Now for the Code:

"TEMP"→Str2
"1234567890"→Str1
1→A
Repeat Str9≠"..P:NT:FN"
Str2+(Str1,A,1)→Str0
0→θ
asm(prgmCELTIC2
A+1→A
End
1→θ
asm(prgmCELTIC2
asm(prgmZRUN

Routine Summary

Retrieves the key code of any key pressed

Calculator Compatibility

TI-83/84/+/SE

:Repeat Ans
:getKey
:End
:Disp Ans

This routine loops until a key is pressed. When a key is pressed, the key code for that specific key is displayed.

The ListPages module does not work recursively.
Getting Involved

A site can only grow and thrive through the continual efforts of its members. If you have found this site useful, we encourage you to contribute and become part of our community.

Sign-ups are available, and our forums are open to questions, commentary, or anything else that you want to talk about. We hope to see you there!

Forum Activity
it doesn't have a cpu cache, but the fixed location in ram can sometimes be referenced as a ram...
(by Trenly 20 Sep 2018 23:11, posts: 6)
The TI-83+ series doesn't have a cache. The difference is that system vars are in a fixed...
(by lirtosiast 20 Sep 2018 22:56, posts: 6)
System vars will always be faster. Because system vars are loaded into memory anytime the system...
(by Trenly 20 Sep 2018 21:30, posts: 6)
Did You Know...
The ListPages module does not work recursively.
Featured Article
The ListPages module does not work recursively.
The ListPages module does not work recursively.
Getting Involved

A site can only grow and thrive through the continual efforts of its members. If you have found this site useful, we encourage you to contribute and become part of our community.

Sign-ups are available, and our forums are open to questions, commentary, or anything else that you want to talk about. We hope to see you there!

Forum Activity
it doesn't have a cpu cache, but the fixed location in ram can sometimes be referenced as a ram...
(by Trenly 20 Sep 2018 23:11, posts: 6)
The TI-83+ series doesn't have a cache. The difference is that system vars are in a fixed...
(by lirtosiast 20 Sep 2018 22:56, posts: 6)
System vars will always be faster. Because system vars are loaded into memory anytime the system...
(by Trenly 20 Sep 2018 21:30, posts: 6)
Did You Know...
The ListPages module does not work recursively.
Top Rated Programs
The ListPages module does not work recursively.
Featured Article
The ListPages module does not work recursively.
Featured Command
The ListPages module does not work recursively.

As a way to test your comprehension of the information, and to ensure that you actually read through the information instead of merely skimming over it, we have provided review exercises. These exercises provide a way of helping you apply the information, so that you get a fuller understanding of the concepts. Highlight the area next to the word answer for the answer.

1. True or False: The ClrHome command should be used at the end of a program, to ensure that the program does not leave any leftover text on the home screen.

Answer:

2. What type of variable cannot hold a complex number?

Answer:

3. Which of the following uses of the Disp command returns an error?

  1. Disp
  2. Disp ""
  3. Disp "Hello World
  4. Disp "Hello","World
  5. None of the above
Answer:

4. Which draw command cannot be called from a program?

Answer:

5. What is the difference between the iPart( and int( commands?

Answer:

6. True or False: Programs can use the home screen for everything they can do on the graph screen.

Answer:

7. What is the minimal modification that will allow this code to start-up?

:Menu("Choose One,"Menu Item",1,"Menu Item",2
:Lbl A
:Pause "Item 1
:Stop
:Lbl 2
:Pause "Item 2
  1. Add a closing quote on the menu title.
  2. Remove the Stop command.
  3. Change Lbl A to Lbl 1.
  4. Add a closing quote on the menu title and change Lbl A to Lbl 1.
Answer:

8. In a statistics class, the teacher asks the students to generate a list of 100 random numbers. Unfortunately, the exercise doesn't work as intended because 22 students, in a class of 30, get the exact same numbers (using different calculators). What's a likely explanation for this surprising coincidence?

Answer:

9. How many digits of accuracy does the TI-OS have? How many can it display on the screen?

Answer:

10. The Output( command can display text at any place on the screen, but what happens when the text goes past the end of the line?

  1. Nothing. The text simply does not show up.
  2. An error is returned.
  3. The text will wrap around to the next line.
  4. An ellipsis will be displayed at the end of the line, with the rest of the text not being displayed.
Answer:

11. True or False: You need to use a Pause command before clearing the screen, otherwise the user will only see the text on the screen for a couple seconds; it will be a blur.

Answer:

12. When is using the Menu( command appropriate, and even desired? (Choose the best answer.)

  1. If you want a generic menu.
  2. Your program is going to be text-based.
  3. It is the most practical menu available in your situation.
  4. You want your program to stand out, so you need a fancy menu.
Answer:

13. What would be the effect of replacing a Disp command with an Output( command and vice verse? Give any instances where this switch might be useful. Also, when would you use Disp in conjunction with Output?

Answer:

14. What is the maximum dimension of a list?

Answer:

15. Which one statement is true about this code?

:Menu("","",B,"",B
:Disp "Test
:Lbl B
:Disp "Pizza
:Output(1,1,"Spaghetti
  1. An error will be returned when the Menu command is executed.
  2. The program will execute, but there will not be any text displayed.
  3. The "Test" text will be displayed along with the "Pizza" and "Spaghetti" text.
  4. The "Pizza" and "Spaghetti" text will be displayed, but not the "Test".
Answer:

16. True or False: Before using the Menu( command, you need to clear the home screen, otherwise you will have text interrupting the menu.

Answer:

17. Consider the following code:

:0:Menu("Difficulty","Easy",3,"Medium",2,"Hard",1
:Lbl 1:Ans+1
:Lbl 2:Ans+1
:Lbl 3:Ans+1

The Ans variable keeps track of the last answer, often being used in place of more permanent variables. If the user selects the "Hard" menu item, what will Ans's value be? What effect does the label ordering have on the value, if any? Why?Answer:

18. True or False: Using the home screen is faster than using the graph screen?

Answer:

19. Which of the following cannot be used to test if a variable is any of 1, 2, 3, or 4?

  1. If sum(A={1,2,3,4
  2. If (A=int(A))(A>=1)(A<=4)
  3. If A={1,2,3,4}
  4. If A(int(A)=A)(A<5)
Answer:

20. True or False: The following is an alternate to using the or operator.

:If (X=1)+(X=2
Answer:

21. Name a command or function that cannot be interrupted by pressing the [ON] key.

Answer:

22. For which of the following would not(B) not equal 0?

  1. .01→B
  2. 0→B
  3. π→B
  4. -4→B
Answer:

23. True or False: The following is an alternative to using the and operator.

:If Anot(B
Answer:

24. How many bytes is an uppercase character? A lowercase character?

Answer:

25. Which of these user-created list names are actually possible on the calculator?

  1. L1234
  2. LBaDd
  3. Lθθθθ
  4. LABCD
Answer:

26. What type of variable needs a special command to store to it?

Answer:

27. Change this short program so it doesn't flicker and then optimize it as much as possible.

:0→X:0→Y:Repeat 0
:ClrHome
:Output(Y,X,"X")
:getKey→K
:If K=24:X-1→X
:If K=25:Y+1→Y
:If K=26:X+1→X
:If K=34:Y-1→Y
:End
Answer:

28. True or False: You can archive another program from within a program.

Answer:

29. What is the maximum length of a string?

Answer:

30. Which of the following variables is it possible to archive?

  1. Y1
  2. prgmKEWLGAME
  3. the real variable T
  4. the real variable A
  5. L_RESID
  6. L1
Answer:

31. Without trying it first, is this legal?

:[A]L4([A]([A](L1(1),L2(1)),L1(1(L2(2L3
Answer:

32. How would you find the fifth element from the last in a sequence of 20 elements?

Answer:

33. What will this code do?

:DelVar B1→A
:If A:If B
:Disp "Hello World
Answer:

34. How do you get rid of the Done message at the end of a program?

Answer:

35. Write a program that inputs a string and outputs the letters backward, one per line.

Answer:

36. Will this code execute?

:If 0:Disp "Your turn
:Else:Disp "Guess not
Answer:

37. What is the simplest program you can have that has recursion?

Answer:

38. Which of these are logically equivalent?

  1. not(P or Q)
  2. P and Q
  3. not(P and Q)
  4. not(P) or not(Q)
  5. not(P) and not(Q)
Answer:

39. True or False: There are actually 256 picture variables on the calculator, even though only 10 picture variables show up.

Answer:

40. What are the differences between Assembly and TI-Basic? When would you use Assembly and when would you use TI-Basic?

Answer:

41. How long will the program go through the loop until it stops execution?

:0→X
:While X
:Disp "Another Loop
:X+1→X
:If X=25
:Stop
:End
Answer:

42. What is wrong with this code?

:If X=25 Then
:Disp "X is 25
:X+1→X
:Disp "X is now", X
:End
Answer:

43. What are the only keys that can actually be held down, causing them to be repeated?

Answer:

44. How would you go about converting a list to a matrix? What would the code look like?

Answer:

45. True or False: There is no built-in way to convert a string to a number.

Answer:

<< Exercises Table of Contents What Next? >>

Author: burr

File Size: No size given

Asks for the number of sides on the die, then asks for the number of rolls. And, of course, it displays the numbers rolled.

Name: Hash 2X
Author: Bxsciencer (aka Jason Lee)
Download: Hash2x.zip
Compatibility: Parent page not set
File Size: 1356 bytes

This is a multivariable hash function that I created. Its pretty fast (especially on a computer), and can have outputs of any size greater than 8 (any less is ridiculously insecure, although a simple edit to the program will allow for any output size greater than 0). However, due to the limitations of the 83/84, 256 is the max inputs and outputs for the moment. The outputs are stored in Str1, so they can be recalled.

There has been no editing of anything except for the files included in this download.

PS. Any help in analyzing this algorithm is most welcome and greatly appreciated.

The code below allows you to move an X around on the home screen, within the boundaries of the four sides of the home screen. This is the same screen that you perform math on and execute programs from. You can end the program by pressing 2nd.

:4→A
:8→B
:Repeat K=21
:getKey→K
:If Ans
:Output(A,B," // 1 space
:min(8,max(1,A+sum(ΔList(Ans={25,34→A
:min(16,max(1,B+sum(ΔList(K={24,26→B
:Output(A,Ans,"X
:End

Why This Works

This code is a collaboration of many optimizations by many members of the ti-basic community. The first lines have always been the same, just initializing the beginning coordinates as a starting point. 4 and 8 are used preferentially because these set the guy at the center. You may use variables other than real ones such as lists, matrices, and strings, but the best way to program this specific example is to use real variables and Ans. Those of you who are somewhat familiar with TI-Basic may have noticed that I have left off the ClrHome command at the beginning of the program. This is for optimizational reasons, and in some cases ClrHome may not be necessary anyway.

:4→A:8→B

After initializing the variables, we then start the main program loop. The main program loop contains the primary code that will be repeated while the program is running. While we could have used any one of the three different loops that exist in TI-Basic for the main program loop (i.e. While, Repeat, or For), the Repeat loop was chosen because it always loops at least once. This allowed us to skip initializing the variable within the loop's condition. The loop condition will be explained later.

:Repeat K=21

Next we read the keypresses of the user with the getKey command. This information is stored into a variable because it is useful to determine when the main program loop should end and to move the X character around the screen. I have chosen the K real variable because 'K' is the first letter of keypress, so it makes it easy to remember what the variable is being used for. While this is primarily just a personal preference, it is good to consistently use the same variables for the same purposes in a program. It's not that important in this program because it is small, but it is definitely important in large programs. After programming for a while, you will begin to develop a habit for which variables you use. Just remember to be consistent.

For some reason, people used to put an extra loop condition around the getKey. We no longer do that because we check if there was a keypress near the output command.

:getKey→K

We then check for the keypress value. The Ans variable assumes the value of the last variable the calculator stored, and because the variable was on the line above, we can use the Ans variable instead of K.
You might be asking why we even need a conditional there. Couldn't we just have the getKey command by itself? Wouldn't that work just as well? While the program would run the same way, the program would not look the same. The conditional is there to prevent flickering when no key has been pressed but the X is erased anyways.

:If Ans
:Output(A,B," // 1 space

The next two lines are the most complicated, yet most important in the entire program. They are used for moving the coordinates of the X character around on the screen. Each of the two coordinate variables A and B is modified using a complicated routine based on the key that was pressed.

:min(8,max(1,A+sum(ΔList(Ans={25,34→A
:min(16,max(1,B+sum(ΔList(K={24,26→B

Now, you are probably wondering why we just didn't use four separate If conditionals instead of combining them into two large math expressions? Why does it need to be so complicated? The reason is that using four If conditionals would slow down the program considerably, and the code would be much larger. If you're not convinced that the piecewise expressions eliminate the need for If conditionals in this program and/or that If conditionals would slow down the program, try using the four separate If conditionals and see the affect for yourself. As I want to drive home the point, I have provided the If conditionals code below for you to type into your calculator. Please do type it in and see for yourself because that's the way you learn and grow as a programmer.

:If K=25 and A>1:A-1→A
:If K=34 and A<8:A+1→A
:If K=24 and B>1:B-1→B
:If K=26 and B<16:B+1→B

This is how this code works. When you press a key, its value is stored to K. We check to see if K equals one of the keys we pressed by comparing it to the lists {24,26 and {25,34. This results in a list {0,1}, {1,0}, or {0,0}. We then take the fancy command Δlist( to see whether to move up, down, left or right. What Δlist( does is quite simple. Δlist( subtracts the first element from the second in the previous list, and stores that as a new one element list, {1}, {-1}, or {0}. We then turn the list into a real number by taking the sum of the one byte list. This 1, -1, or 0 is added to A.

After this, we compare A to 1, and take larger of the two, to make sure the coordinate isn't too low. That number is compared to 8 or 16, to make sure the other coordinate isn't too high. This number is stored as A or B, and thus we have our formula.

After adjusting the two coordinate variables, we then display the X character at its new position on the screen. Since the Ans variable currently contains the B variable's value, we can use Ans instead of B for displaying the column. It is completely preferential whether you do this, but developing optimizational habits is good for when you make larger programs and speed really matters. It is left in to show what the optimized version of the program looks like.

:Output(A,Ans,"X

Finally, we close the main program loop with an End command. The condition in the loop is tested when the program reaches the End command, so the program will now check the K variable to see if the user has pressed 2nd.

:End

And thus we have the full movement code.

Graph Screen

The differences here are that we need to start by setting up window coordinates, which can be found here, we need to change the start points and limits of the variables to the appropriate X,Y coordinates, and the display routine is able to use only one line function do to its optional fifth argument. This argument determines whether to turn off pixels or turn them on. We manipulate this fact by checking if K has been pressed algebraically. Here is the full code.

:Zstandard
:104→Xmax
:72→Ymax
:Zinteger
:1→A
:1→B
:Repeat K=21
:getKey→K
:Line(A,B,A,B,not(K
:min(94,max(0,A+sum(ΔList(K={24,26→A
:min(62,max(0,B+sum(ΔList(K={34,25→B
:End

Author

Program Description

PLEASE REMOVE the following words that do NOT describe your program:
Arcade Graphics Platform Puzzle RPG Strategy Sports Casino Board Utility Misc

http://tibasicdev.wikidot.com/local--files/home/no_image_2.png

Unavailable

Program size in bytes

Name: Roman Numeral Converter
Author: patriotsfan
Download: TIBD04.zip
Compatibility: Parent page not set
File Size: 388 bytes
This program converts Arabic Numerals to Roman Numerals. It does not use any strings!

Routine Summary

Returns a list of the frequency of values in another list sorted.

Inputs

L₁ - the list you want to find the frequency of

Outputs

L₂ - the values of L₁ without repetition sorted
L₃ - the frequencies of the values in the list L₂ sorted

Variables Used

L₁, L₂, L₃, θ

Calculator Compatibility

TI-83/84/+/SE

Author

Galandros

URL: United TI

Download

listfrequency2

:DelVar L₂DelVar L₃SortA L₁
:For(θ,1,dim(L₁
:L₁(θ→L₂(1+dim(L₂
:sum(L₁=Ans→L₃(dim(L₂
:θ-1+Ans→θ
:End

In the first line we initialize L₁, L₂, and L₃. We sort L₁ so like values will be adjacent.

Then we start looping by storing the first value encountered to the next element of list L₂.
In the next line we find the frequency of the value already stored in L₂ and is stored to the correspondent element in L₃. θ is increased by the frequency found minus 1 to pass to next number, but then incremented by 1 in the For loop.
We loop we reach the end of L₁.

And that's it. The output is put on L₂ and L₃ already sorted. Notice how well Ans is used for speed and size optimization.

When you are done using L₁, L₂, and L₃, you should clean them up at the end of your program.

The ListPages module does not work recursively.

{$tutorialsBegin}

Besides reading the programming information that this wiki provides, there are several additional quality TI-Basic tutorials that other people have created that you might find handy.

Name Author
Complete TI-Basic Optimization Guide Arthur O'Dwyer
1337 Guide to TI-Basic Jonathan Pezzino & Kerm Martian
Making TI-Basic Shells Patrick Stone
2D TI-Basic Sprites Alex Snyder
Advanced Thinking Fred Sparks
No-Lib Guide to Sprites and Maps Thomas Dickerson
TI-Basic Greyscale Kevin Ouellet
TI-Freakware Tutorials Daniel Thorneycroft
Complete TI-Basic Tutorial Kerm Martian
BASIC Guru Tutorials Ben Ilegbodu
MJS 2000 Tutorials Unknown
Rogue's TI-86 Basic Tutorial Andrew Matta
HeaneySoft BASIC Tutorial Wayne Heaney
TI-83 Programming Tutorials Lue Her & Andy Becker
TI-Basic for Noobs Matt Lee

{$tutorialsEnd}

{$utilitiesBegin}

While the calculator itself is the predominant place to program TI-Basic, another viable option is programming on a computer. There are several computer tools available, which provide a very rich programming environment.

Name Author Description
SourceCoder 3 Kerm Martian This is an online editor that parses TI-Basic code and presents it with the appropriate tokens. It can convert .8xp fies to source code, as well as let you edit and create programs online and export them as .8xp files. The latest revision adds image tools to parse and create .8xi images, png files, sprites, and more.
BasicBuilder Martin Warmer Programs with lots of subroutines get annoying rather quickly. BasicBuilder solves this issue by allowing you to compile all programs, subroutines, and pictures into a Flash Application. It also compresses your programs, saving some memory.
CalcCapture André Felix Miertschink Most commonly used in conjunction with Flash Debugger, CalcCapture allows you to take still or animated screenshots in gif format of any running Windows program.
TI-Graph Link Texas Instruments This program is used for programming TI-Basic on the computer. It has an easy-to-use interface, featuring all of the menus and functions of the calculator itself. In addition, it is used for transferring files back and forth between the computer and calculator.
JALcc IDE Stef Mientki Editing TI-Basic has always been a rather slow, tedious process because of the screen limitations and the fact that distinguishing the code can be difficult. JALcc solves this problem by utilizing code-coloring commands, indenting nested commands, and allowing you to make large multi-line comments.
Manual Texas Instruments Even if you have a physical copy of the manual, an electronic copy is still needed. It is much more convenient to just open up the electronic manual, then to have to carry the physical manual around.
Online TI File Converter ZeWaren Can create and convert data from many calculators, such as the TI-82, TI-83, and TI-83+/84+.
Rom8x Andree Chea With the difficulty of getting ROM images from the newer calculators, this program allows you to bypass that problem. It is most useful for those with a USB cable.
TI Connect Texas Instruments This program is the updated version of Graph Link. It primarily features faster speed because it works with the USB cable. However, it does have compatibility issues with the newer calculators.
VTI Capture André Felix Miertschink Works with VTI to get screenshots. It allows for both still and animated screenshots and has extra features like contrast adjustment, adding extra borders and some others.
TiLP Romain Liévin A linking program for Linux and Windows. It works on Vista 64 bit, while TI-Connect does not.
TI-Connect CE Texas Instruments A linking program for Windows and Mac. It includes an updated GUI and a simple code editor.

{$utilitiesEnd}

{$oncalc-utilitiesBegin}

There are many programs that will assist your programming on-calc, such as in the creation of games or sprites.

Name Author Description
ASCII Editor Robin Peters This program allows programmers to simply create single and dual layer maps, as well as get tokens that are normally not available on the calculator and easily try different combo's of tokens. The programmer then can use the map for his/her RPG, sidescroller, puzzle or maze game, etc.
Basic MapMaker MDR Falcon This helps programmers create maps in basic, without the hassle of typing in a long string or matrix.
Lunar IDE Jonah Scheinerman This is an on-calc program editor, with many built-in tools to allow more ease when programming.
Random Maze Generator James Pruit This program generates random 9x9 mazes that can be used in your own programs.
RPGSK2 Daniel Thorneycroft This helps programmers learn how to use 4 way scrolling ASCII maps.
Symbols Daniel Thorneycroft & Kerm Martian This allows programmers to use any of the 131 symbols normally unavailable in Basic programs.
Text Sprite Finder Robert Moy This helps programmers create text sprites for use in their own programs.

{$oncalc-utilitiesEnd}

{$emulatorsBegin}

An emulator allows you to run a virtual form of your calculator on your computer, which is very convenient when you want to make quick changes to programs, or do any debugging or optimizing.

Name Author TI-83 TI-83+ TI-83+SE TI-84+ TI-84+SE TI-84+CSE TI-84+CE
Emu8x Michael Vincent X
Flash Debugger Texas Instruments X X
TilEm Benjamin Moody & Solignac Julien X X X X X
PindurTI Patai Gergely X X
VTI-Alpha Corey Taylor & Rusty Wagner X X
VTI-Beta Rusty Wagner X X
WabbitEmu (WIN) Spencer Putt & James Montelongo X X X X X X
WabbitEmu (MAC) Spencer Putt & James Montelongo X X X X X X
jsTIfied Christopher Mitchell X X X X X X O

{$emulatorsEnd}

{$related-sitesBegin}

There are many TI sites out there, providing their own set of services and features.

Ticalc.org Omnimaga Cemetech CodeWalrus TI-Planet
CalcGames TI-Freakware RevSoft MaxCoderz TI-Story

{$related-sitesEnd}

Name: Decimal to Roman Numeral Converter
Author: Zaphod_Beeblebrox
Download: Roman.zip
Compatibility: Parent page not set
File Size: 187 bytes
Converts a decimal number to a roman numeral.

output.png

Command Summary

Output is used to display text to pixel coordinates on the Program I/O screen.

Command Syntax

Output row,col,text

Menu Location

Starting in the program editor:

  • Press F3 to enter the I/O menu.
  • Press 6 to paste Output.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

The Output command is the most basic command for displaying text. It can display any type of expression on the Program I/O screen in the large font, using "Pretty Print" if it is enabled. It uses (row, column) pixel coordinates to determine the top left corner from which it displays the expression. By far the most common use of Output is for displaying strings.

:Output 20,20,"Hello, world"

Advanced Uses

Both the row and the column coordinates for displaying text can be arbitrary integers — they can be negative, and they can go off-screen. The portion of the text that fits on the screen (if any) is drawn, and the rest is omitted: there is no wrapping of any kind.

Related Commands

The ListPages module does not work recursively.
Name: Byte Converter
Author: RandomProductions
Download: ByteConv.zip
Compatibility: Parent page not set
File Size: 1619 bytes
Byte Converter allows you to convert between units of memory from the bit to the terabyte, even nybbles. The units follow the IEC standard of Kibibytes, Mebibytes, and so on, but are written as Kilobytes, Megabytes, and son.
Name: challenge 4
Author: noah maddox
Download: Roman.zip
Compatibility: Parent page not set
File Size: 419
my entry to challenge 4

This is how the calculator really works. The following is based on my knowledge of how computers work. Since the calculator at this point is a computer, I thought this knowledge of mine would come nicely. I will have analogies referring to computers, but that's to be expected in this article

On, Sleep, On, Sleep, On, Sleep…

Yes, it's true. Your computer only turns off when it "crashes". Read on.

On for the Very First Time

When you unpackage your new TI-84+ and turn it on, you're turning it on from a complete off state, as if you turn on your computer for the first time.

Off? Try Sleep

Every single time you press the off button, you're actually suspending the calculator's activities. Basically, putting the calculator to sleep, like on a computer.
In the old days of TI calculators, when calculators ran on AC power and required special "modules" in the back to work, when you turned off the calculator, it was off. Any programs you had written were lost, because they were in the RAM. Nowadays, the calculator just goes to sleep.

Crashed Calc!

When your calc crashes, you are forced to turn it off, by taking out a battery. This is the same as your computer freezing up, and requiring you to hold down the power button for a few seconds. This is the only way you can force your calculator off, by causing it to crash. At this point, it says RAM Cleared like it is a scary thing, but it isn't.

Final Notes on Calculator RAM

It seems funny that RAM on a TI-83 and RAM on a computer are viewed as two completely different things, when they are exactly the same. A program that is in the RAM on the calc is like an unsaved document on your computer. The RAM Cleared message you may get really says, "Your calculator turned off completely, and it cleared the RAM like your computer would if you turned it off." The RAM on your calc acts like any other RAM in computers.

neural network

Introduction

Artificial intelligence, often abbreviated AI, is a branch of computer science concerning the intelligence of machines. More specifically, artificial intelligence is the ability of inorganic automaton to perceive their environment and make rational decisions based on data acquired. Used in applications with dynamic environments, as opposed to static, AI attempts to provide solutions to problems without the need of human interaction. The entire purpose behind utilizing AI is to allow automata to make decisions as if it were human. In essence, AI is an effort to emulate the human mind in settings where a real human would be impossible or impracticable to use.

Characteristics of AI

In the game industry, AI allows a CPU to compete against a human player (or another CPU) under the rules governing the game. For example, a chess AI will analyze the game and attempt to make moves which will maximize its success. Other examples of AI include speech recognition used in cell phones, automatic thermostat controls, and the navigation system used in autonomous robotic vacuum cleaners. In each of these applications, AI combines multiple elements together to complete a task based on the data presented. Breaking the AI into individual qualities allows these elements to be characterized.

In order for a system to be considered artificially intelligent, it must exhibit at least three established characteristics. These characteristics are referred to as the “three A’s”; acquire, analyze, action.

Acquire

An AI system has the ability to make observations about its environment.
Whether the observations are physical or purely numerical, they represent data acquired by the AI.

Analyze

An AI system has the ability to evaluate the data acquired and arrive at a conclusion. A chess AI will analyze board piece locations to determine a set of possible actions which will maximize its probability of winning the game.

Action

An AI system has the ability to make rational choices based on the conclusion of the analysis. This characteristic is especially important as it represents the AI’s function as an agent. In other words, the AI has the ability to choose its course of action, doing so in a rational manner.

The three A’s were specifically chosen in order to differentiate true AI from what is otherwise an automated entity performing a predetermined set of tasks. Industrial robots may appear to have AI; however, they are simply machines following programmed instructions. They do not have the ability to acquire nor analyze environmental data. Another misleading use of the word AI is toward game opponents. Often, game opponents that give the impression of being artificially intelligent are nothing more than controlled systems abiding by a set of rules according to the current situation. An example would include Goombas and Koopa Troopas commonly found throughout many Mario series. They do not have AI since they do not possess the defining characteristic of action. In other words, they do not have the ability to make choices. Although Goombas and industrial robots do not have AI, this doesn’t mean that they could not utilize AI.

For example, the industrial robot could be equipped with a humidistat and sound level meter in order to collect data about environmental humidity and decibel levels respectively. The robot could then analyze the information and make decisions based on the results of the analysis. A possible action may be to activate evaporation fans if the humidity rises above a certain level or to reduce operation speed if the environment decibel levels exceed regulation. While less independent, as may be associated with AI, the industrial robot in this proposed setting abides by the rules established for characterizing artificial intelligence. The robot has the ability to acquire, analyze, and take action based on environmental data, making rational decisions towards achieving a goal.

Understanding AI

Developing artificial intelligence involves critical thinking and requires an interrogative approach towards its application. It is often necessary to analyze human thought patterns when designing an AI. The process through which an individual arrives at a conclusion in a game of checkers is likely similar to the sequence of steps an AI should take to maximize competency. Thus to better understand artificial intelligence, it is worthwhile to consider the entity from which it is being modeled, the human brain.

With estimated 50-100 billon neurons and approximately 100 trillion synaptic connections linking the neurons, the human brain is arguably the most powerful computer in existence.

Prerequisites

Logic

In order to take action based on what it analyzes, an AI must use logical and conditional statements pertaining to the operation it has been programmed to do. For example, in a game of "Tic Tac Toe", the AI must be able to use logic statements to determine where to place the next 'X' or 'O' in order to either block its opponent or complete a 3-in-a-row for itself. Logic statements can also be used to put certain actions at a higher priority than others. For example, a "Tic Tac Toe" AI will attempt to complete its own 3-in-a-row before blocking the opponent, because if it has already won, then the game is over and there is no chance of the opponent winning.

Procedural Programming

Control Flow

Data Structures

Environment

Code Structure

Gather Variables

Components

Thinking like AI

To program an AI you must think like one. You must not think like you would because if you were making the move in "Tic Tac Toe", you would reason on which move would be better, but the Calculator can't do this. All it can do is execute your code and make choices depending on whats true at the time and what your code tells it to do.

Conditionals

Conditionals are programming objects that check if an event is true and run a section of code if it is. In Ti Basic, the most applicable conditional for AI is If, and less common, While(, Repeat(,
For(, IS>(, and DS<(. Conditionals are the easiest way to reach an action from input information (it represents Analyze of the "three A's").

Probability

In a game that contains random elements as a mechanic, such as dice, cards, and spinners, a good AI must account for them in a logical manner. One way to implement this would be to do a weighted average of all the possible options, based on the likelihood of each outcome and a calculable value for how well the game is going.

Methods

There are many methods that an AI can use to calculate a move, each with their own strengths and weaknesses. These are some of the most popular.

MiniMax

MiniMaxing is a method of AI in which each possible move is plotted on a tree, the computer finds the most achievable end state, and takes moves to reach that state. Note that the end state does not have to be the best possible state; for example, a MiniMax "Tic Tac Toe" AI won't try to attempt 3 in a row assuming that its opponent won't try to stop it. Instead, a MiniMax AI assumes that its opponent will make the best possible moves, and then find moves that lead to the worst possible 'best' moves: in other words, the minimum maximum. MiniMaxing is suited for AI that should play perfectly, and thus might not be a good fit for a fun game opponent. This approach works best for smaller, shorter games like "Tic Tac Toe" where there aren't too many moves to plot, and the number of possible moves decreases over time. MiniMaxing in a game such as "Chess" is much more difficult, due to there being an increasing, large number of moves, so much so that such an endeavor is currently infeasible. MiniMaxing also doesn't work well for real-time games where each 'turn' happens every interactable frame.

Decision Tree

The decision tree AI is the most common and the most applicable AI in video games (and is also the easiest to implement on a graphing calculator). A decision tree's foundation is the conditional. The programmer codes in certain events, has the computer check if those events are true, and then has it run code if it is true. For the game "Tic Tac Toe", the programmer might have the computer check if it has a 2 in a row on the board. If so, then they will have it choose the 3rd empty tile. This approach to AI is the best suited for games due to its logical, predictable, and easy to implement system of conditionals. Because of the decision tree's simple nature, it is by far the best choice for TI Basic.

Self-Learning

First of all, letting a calculator learn is not really possible, however it is possible to let it remember and compare, thus creating the illusion it has learned. Let's see an example, "Tic Tac Toe", in this game it could be possible for the program to store all the games it played in lists, whenever the program can't figure a good move using the normal routine it can refer back to the lists and compare the list with the actual situation, now if the situation matches it could give a good move based on what it did good or bad in the list it is comparing to. This way of learning would prevent the human player from applying the same tactic over and over again, ergo, the machine seems to have learned what to do when this "tactic" appears. A good example of Self learning is deep blue, this was a machine developed by IBM that won a deciding chess game against the best human chess player at that time.

Conclusion

work in progress

Name: Action Identifier
Author: Aaron Gaba
Download: ActionID.zip
Compatibility: Parent page not set
File Size: 1,671 bytes
A little chemistry that helps determine chemical and physical changes. Includes also a "textbook guide" to the 5 indicators of a chemical change and a built-in help guide.
Name: Codon Analysis System
Author: Aaron Gaba
Download: CAS.zip
Compatibility: Parent page not set
File Size: 12 KB
A biology program which transcribes basic codons, tells you the amino acid it codes for, and gives the tRNA anti-Codon.
Name: Spider
Author: Builderboy2005
Download: Spider.zip
Compatibility: Parent page not set
File Size: 2358 Bytes
The simple game of Spider entails arranging the pipes so the spider can crawl through them for as long as possible. There are 3 Difficulty settings which enable extra pipe sections, and make the spider move faster. A highscore table is avaailiable so you can boast to your Friends! An Angel Production.
Name: Six Differences
Author: BuilderBoy2005
Download: SixDiff.zip
Compatibility: Parent page not set
File Size: 4152 Bytes
An Angel production! In Six Differences, you attempt to find the six differences in the two pictures displayed side by side on your calculator. Has 9 well designed levels, with a feature to install multiple level packs, AND a custom level editor. Uses a revolutionary system to store levels as a series of lines, which eliminates the need for picture variables, allowing the entire game to be hosted in One Program! Create your own levels! Install new level packs! Find the Differences!!
Name: Exact Quadratic
Author: noah maddox
Download: Quad.zip
Compatibility: Parent page not set
File Size: 694 bytes
An exact quadratic solver displays answers in "pretty print" look at picture to see
Name: program challenge 3 entry
Author: graphmastur
Download: Animation.8xp
Compatibility: Parent page not set
File Size: ?
This is my entry to program challenge 3
Name: Collect! (beta)
Author: Architeuthiskid
Download: Collect.zip
Compatibility: Parent page not set
File Size: Close to 3000 bytes for both versions
In collect, you go around and collect the dots that appear as soon as you eat the previous one. It is almost exactly the same as snake, with the major difference that the dot does NOT grow. If you move 100 times, or hit one of the walls, it's game over. For further info, look at the readme. Remember, this is a beta version, so it is lacking in many features that I will add later.
edit: I can't upload the new versions, due to computer difficulties.

Routine Summary

Returns the sum of digits of a number.

Inputs

X - the number you want

Outputs

Ans - the sum of X's digits

Variables Used

X, Ans

Calculator Compatibility

TI-83/84/+/SE

Author

DarkerLine

URL: United TI

:sum(int(10fPart(Xseq(10^(-I-1),I,0,log(X

With our number stored in X, we loop through each of the digits of the number starting from the right using the seq( command. We get the respective digit by raising the number to the respective power of 10 and then multiplying the result by 10. The digits are returned separately in a list, and then we take the sum of them using the sum( command.

For example, if the number is 1234, we get a list of {1,2,3,4}, which then returns a sum of 10. You should note, though, that this routine only works with positive and negative whole numbers, and will return incorrect results if you try to use a decimal number. You could fix this problem by using the code below instead:

:abs(E13(X/10^(int(log(abs(X+not(X→X

Here, we obtain the appropriate power of ten by which to divide the number so as to leave only one digit to the left of the decimal point. Because a real variable may contain only 14 digits, the answer is multiplied by 10^13 to guarantee the removal of any fractional part. From taking the absolute value of this new result, our number can be safely entered into the routine above.

Note: It should be understood that this routine is only capable of adding the first 14 digits of a number. An input of π, for instance, would return 69 even though the sum of all digits of π is infinite.

Related Routines

Name: Chemical Equation Solver
Author: Edward Hou
Download: ChemEq1.0.zip
Compatibility: Parent page not set
File Size: 928 bytes
Balances chemical equations, inputted as a string.
All View Programs: TI-83 TI-83 Plus TI-84 Plus Upload Program: TI-83 TI-83 Plus TI-84 Plus
Name: Nibbles (Snake)
Author: Edward H
Download: Nibbles.8xp
Compatibility: Parent page not set
File Size: 580 Bytes
Nibbles is a version of snake, which is very graphical and very fast. This version of snake is unique because it doesn't use any list variables to control the movement of the snake.

A | B | C | D | E | F | G | H | I | L | M | N | O | P | Q | R | S | T | U | V | W | X | Z | Miscellaneous

Some commands have a superscript next to them that indicates compatibility:

  • 83+ indicates that the command requires a TI-83+, TI-83+SE, TI-84+, or TI-84+SE calculator.
  • 84+ indicates that the command requires a TI-84+ or TI-84+SE calculator.
  • 84+2.30 indicates that the command requires a TI-84+ or TI-84+SE calculator with OS 2.30 or higher.

Command Summary

Displays a list of most available commands in alphabetical order.

Menu Location

Press 2nd CATALOG to access the catalog

A

abs(
and
angle(
ANOVA(
Ans
Archive 83+
Asm( 83+
AsmComp( 83+
AsmPrgm 83+
augment(
AxesOff
AxesOn
a+bi

B

bal(
binomcdf(
binompdf(
Boxplot

C

χ²cdf(
χ²pdf(
χ²-Test(
χ²GOF-Test( 84+2.30
checkTmr( 84+
Circle(
Clear Entries
ClockOff 84+
ClockOn 84+
ClrAllLists
ClrDraw
ClrHome
ClrList
ClrTable
conj(
Connected
CoordOff
CoordOn
cos(
cosֿ¹(
cosh(
coshֿ¹(
CubicReg
cumSum(

D

dayOfWk( 84+
dbd(
►Dec
Degree
DelVar
DependAsk
DependAuto
det(
DiagnosticOff
DiagnosticOn
dim(
Disp
DispGraph
DispTable
►DMS
Dot
DrawF
DrawInv
DS<(

E

e
e^(
E
►Eff(
Else
End
Eng
Equ►String(
ExecLib 84+
expr(
ExpReg
ExprOff
ExprOn

F

Fcdf(
Fill(
Fix
Float
fMax(
fMin(
fnInt(
FnOff
FnOn
For(
fPart(
Fpdf(
►Frac
Full
Func

G

GarbageCollect 83+
gcd(
geometcdf(
geometpdf(
Get(
GetCalc(
getDate 84+
getDtFmt 84+
getDtStr( 84+
getKey
getTime 84+
getTmFmt 84+
getTmStr( 84+
Goto
GraphStyle(
GridOff
GridOn
G-T

H

Histogram
Horiz
Horizontal

I

i
identity(
If
imag(
IndpntAsk
IndpntAuto
Input
inString(
int(
ΣInt(
invNorm(
invT( 84+2.30
iPart(
irr(
IS>(
IsClockOn 84+

J

K

L


LabelOff
LabelOn
Lbl
lcm(
length(
Line(
LinReg(a+bx)
LinReg(ax+b)
LinRegTInt 84+2.30
LinRegTTest
ΔList(
List►matr(
ln(
LnReg
log(
Logistic

M

Manual-Fit 84+2.30
Matr►list(
max(
mean(
median(
Med-Med
Menu(
min(
ModBoxplot

N

nCr
nDeriv(
►Nom(
Normal
normalcdf(
normalpdf(
NormProbPlot
not(
nPr
npv(

O

OpenLib( 84+
or
Output(

P

Param
Pause
Plot1(
Plot2(
Plot3(
PlotsOff
PlotsOn
Pmt_Bgn
Pmt_End
poissoncdf(
poissonpdf(
Polar
►Polar
PolarGC
prgm
ΣPrn(
prod(
Prompt
1-PropZInt(
2-PropZInt(
1-PropZTest(
2-PropZTest(
Pt-Change(
Pt-Off(
Pt-On(
PwrReg
Pxl-Change(
Pxl-Off(
Pxl-On(
pxl-Test(
P►Rx(
P►Ry(

Q

QuadReg
QuartReg

R

Radian
rand
randBin(
randInt(
randM(
randNorm(
re^θi
Real
real(
RecallGDB
RecallPic
►Rect
RectGC
ref(
Repeat
Return
round(
*row(
row+(
*row+(
rowSwap(
rref(
R►Pr(
R►Pθ(

S

2-SampFTest
2-SampTInt
2-SampTTest
2-SampZInt(
2-SampZTest(
Scatter
Sci
Select(
Send(
seq(
Seq
Sequential
setDate( 84+
setDtFmt( 84+
setTime( 84+
setTmFmt( 84+
SetUpEditor
Shade(
Shadeχ²(
ShadeF(
ShadeNorm(
Shade_t(
Simul
sin(
sinֿ¹(
sinh(
sinhֿ¹(
SinReg
solve(
SortA(
SortD(
startTmr 84+
stdDev(
Stop
StoreGDB
StorePic
String►Equ(
sub(
sum(

T

tan(
tanֿ¹(
Tangent(
tanh(
tanhֿ¹(
tcdf(
Text(
Then
Time
timeCnv( 84+
TInterval
tpdf(
Trace
T-Test
tvm_FV
tvm_I%
tvm_N
tvm_Pmt
tvm_PV

U

UnArchive 83+
uvAxes
uwAxes

V

1-Var Stats
2-Var Stats
variance(
Vertical
vwAxes

W

Web
While

X

xor
xyLine

Y

Z

ZBox
ZDecimal
ZInteger
ZInterval
Zoom In
Zoom Out
ZoomFit
ZoomRcl
ZoomStat
ZoomSto
ZPrevious
ZSquare
ZStandard
Z-Test(
ZTrig

Miscellaneous

! (factorial)
° (degree-symbol)
r (radian-symbol)
T (transpose)
×√ (xroot)
³ (cube)
³√( (cube-root)
= (equal)
≠ (not equal)
< (less than)
> (greater than)
≤ (less than or equal to)
≥ (greater than or equal to)
□ (plotsquare)
+ (plotcross)
∙ (plotdot)
-1 (inverse)
² (square)
^ (power)
‾ (negative)
10^( (ten-exponent)
√( (square-root)
* (multiply)
/ (divide)
+ (add)
- (subtract)
{ (left list indicator)
[ (left matrix indicator)
( (left parenthesis)
} (right list indicator)
] (right matrix indicator)
) (right parenthesis)
, (comma)
' (apostrophe)
" (quotation)
: (colon)
π (pi)
? (interrogatory mark)

This variable-width character set is more common to the graph screen. For the larger font, please see this article.

Character Map

Click on any character to jump ahead and view its respective details.

0 1 2 3 4 5 6 7 8 9 A B C D E F
0 SrecurN SrecurU SrecurV SrecurW Sconvert SFourSpaces SsqDown Sintegral Scross SboxIcon ScrossIcon SdotIcon SsubT ScubeR ShexF
1 Sroot Sinverse Ssquare Sangle Sdegree Sradian Stranspose SLE SNE SGE Sneg Sexponent Sstore Sten SupArrow SdownArrow
2 Sspace Sexclam Squote Spound Sdollar Spercent Sampersand Sapostrophe SlParen SrParen Sasterisk SplusSign Scomma Sdash Speriod Sslash
3 S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 Scolon Ssemicolon SLT SEQ SGT Squestion
4 SatSign ScapA ScapB ScapC ScapD ScapE ScapF ScapG ScapH ScapI ScapJ ScapK ScapL ScapM ScapN ScapO
5 ScapP ScapQ ScapR ScapS ScapT ScapU ScapV ScapW ScapX ScapY ScapZ Stheta Sbackslash SrBrack Scaret Sunderscore
6 Sbackquote SmallA SmallB SmallC SmallD SmallE SmallF SmallG SmallH SmallI SmallJ SmallK SmallL SmallM SmallN SmallO
7 SmallP SmallQ SmallR SmallS SmallT SmallU SmallV SmallW SmallX SmallY SmallZ SlBrace Sbar SrBrace Stilde SinvEQ
8 Ssub0 Ssub1 Ssub2 Ssub3 Ssub4 Ssub5 Ssub6 Ssub7 Ssub8 Ssub9 ScapAAcute ScapAGrave ScapACaret ScapADier SaAcute SaGrave
9 SaCaret SaDier ScapEGrave ScapEAcute ScapECaret ScapEDier SeAcute SeGrave SeCaret SeDier ScapIAcute ScapIGrave ScapICaret ScapIDier SiAcute SiGrave
A SiCaret SiDier ScapOAcute ScapOGrave ScapOCaret ScapODier SoAcute SoGrave SoCaret SoDier ScapUAcute ScapUGrave ScapUCaret ScapUDier SuAcute SuGrave
B SuCaret SuDier ScapCCed ScCed ScapNTilde SnTilde Saccent Sgrave Sdieresis SquesDown SexclamDown Salpha Sbeta Sgamma ScapDelta Sdelta
C Sepsilon SlBrack Slambda Smu Spi Srho ScapSigma Ssigma Stau Sphi ScapOmega SxMean SyMean SsupX Sellipsis Sleft
D Sblock Sper Shyphen Sarea Stemp Scube Senter SimagI Sphat Schi SstatF Slne SlistL SfinanN S2_r_paren SnarrowCapE
E SListLock Sscatter1 Sscatter2 Sxyline1 Sxyline2 Sboxplot1 Sboxplot2 Shist1 Shist2 SmodBox1 SmodBox2 Snormal1 Snormal2 STwoSpaces SThreeSpaces SFiveSpaces
F SSixSpaces ScurFull Sdollar SsqUp SsharpS SMPmixedFrac SMPfracSlash SMPentryBox

Introduction

The following chart depicts each character with its hexadecimal equivalent, name, and pixel width.

Individual Characters

SrecurN Hex: 01
Name: "Recursive n"
Width: 6px
SrecurU Hex: 02
Name: "Recursive u"
Width: 4px
SrecurV Hex: 03
Name: "Recursive v"
Width: 4px
SrecurW Hex: 04
Name: "Recursive w"
Width: 4px
Sconvert Hex: 05
Name: "Convert"
Width: 4px
SFourSpaces Hex: 06
Name: "Four Spaces"
Width: 4px
SsqDown Hex: 07
Name: "Square Down"
Width: 5px
Sintegral Hex: 08
Name: "Integral"
Width: 4px
Scross Hex: 09
Name: "Cross"
Width: 4px
SboxIcon Hex: 0A
Name: "Box Icon"
Width: 4px
ScrossIcon Hex: 0B
Name: "Cross Icon"
Width: 4px
SdotIcon Hex: 0C
Name: "Dot Icon"
Width: 4px
SsubT Hex: 0D
Name: "Subscript T"
Width: 4px
ScubeR Hex: 0E
Name: "Cube Root"
Width: 4px
ShexF Hex: 0F
Name: "Hexadecimal F"
Width: 5px
Sroot Hex: 10
Name: "Root"
Width: 4px
Sinverse Hex: 11
Name: "Inverse"
Width: 5px
Ssquare Hex: 12
Name: "Square"
Width: 4px
Sangle Hex: 13
Name: "Angle"
Width: 4px
Sdegree Hex: 14
Name: "Degree"
Width: 5px
Sradian Hex: 15
Name: "Radian"
Width: 5px
Stranspose Hex: 16
Name: "Transpose"
Width: 4px
SLE Hex: 17
Name: "Less Than or Equal To"
Width: 5px
SNE Hex: 18
Name: "Not Equal To"
Width: 6px
SGE Hex: 19
Name: "Greater Than or Equal To"
Width: 5px
Sneg Hex: 1A
Name: "Negation"
Width: 4px
Sexponent Hex: 1B
Name: "Exponent"
Width: 4px
Sstore Hex: 1C
Name: "Store"
Width: 5px
Sten Hex: 1D
Name: "Ten"
Width: 6px
SupArrow Hex: 1E
Name: "Up Arrow"
Width: 3px
SdownArrow Hex: 1F
Name: "Down Arrow"
Width: 3px
Sspace Hex: 20
Name: "Space"
Width: 1px
Sexclam Hex: 21
Name: "Exclamation Mark"
Width: 2px
Squote Hex: 22
Name: "Quotation Mark"
Width: 4px
Spound Hex: 23
Name: "Pound Sign"
Width: 6px
Sdollar Hex: 24
Name: "Dollar Sign"
Width: 6px
Spercent Hex: 25
Name: "Percent Sign"
Width: 4px
Sampersand Hex: 26
Name: "Ampersand"
Width: 5px
Sapostrophe Hex: 27
Name: "Apostrophe"
Width: 2px
SlParen Hex: 28
Name: "Left Parenthesis"
Width: 3px
SrParen Hex: 29
Name: "Right Parenthesis"
Width: 3px
Sasterisk Hex: 2A
Name: "Asterisk"
Width: 6px
SplusSign Hex: 2B
Name: "Plus Sign"
Width: 4px
Scomma Hex: 2C
Name: "Comma"
Width: 3px
Sdash Hex: 2D
Name: "Dash"
Width: 4px
Speriod Hex: 2E
Name: "Period"
Width: 2px
Sslash Hex: 2F
Name: "Slash"
Width: 4px
S0 Hex: 30
Name: "0"
Width: 4px
S1 Hex: 31
Name: "1"
Width: 4px
S2 Hex: 32
Name: "2"
Width: 4px
S3 Hex: 33
Name: "3"
Width: 4px
S4 Hex: 34
Name: "4"
Width: 4px
S5 Hex: 35
Name: "5"
Width: 4px
S6 Hex: 36
Name: "6"
Width: 4px
S7 Hex: 37
Name: "7"
Width: 4px
S8 Hex: 38
Name: "8"
Width: 4px
S9 Hex: 39
Name: "9"
Width: 4px
Scolon Hex: 3A
Name: "Colon"
Width: 2px
Ssemicolon Hex: 3B
Name: "Semicolon"
Width: 3px
SLT Hex: 3C
Name: "Less Than"
Width: 4px
SEQ Hex: 3D
Name: "Equal To"
Width: 4px
SGT Hex: 3E
Name: "Greater Than"
Width: 4px
Squestion Hex: 3F
Name: "Question Mark"
Width: 4px
SatSign Hex: 40
Name: "At Sign"
Width: 6px
ScapA Hex: 41
Name: "Capital A"
Width: 4px
ScapB Hex: 42
Name: "Capital B"
Width: 4px
ScapC Hex: 43
Name: "Capital C"
Width: 4px
ScapD Hex: 44
Name: "Capital D"
Width: 4px
ScapE Hex: 45
Name: "Capital E"
Width: 4px
ScapF Hex: 46
Name: "Capital F"
Width: 4px
ScapG Hex: 47
Name: "Capital G"
Width: 4px
ScapH Hex: 48
Name: "Capital H"
Width: 4px
ScapI Hex: 49
Name: "Capital I"
Width: 4px
ScapJ Hex: 4A
Name: "Capital J"
Width: 4px
ScapK Hex: 4B
Name: "Capital K"
Width: 4px
ScapL Hex: 4C
Name: "Capital L"
Width: 4px
ScapM Hex: 4D
Name: "Capital M"
Width: 4px
ScapN Hex: 4E
Name: "Capital N"
Width: 4px
ScapO Hex: 4F
Name: "Capital O"
Width: 4px
ScapP Hex: 50
Name: "Capital P"
Width: 4px
ScapQ Hex: 51
Name: "Capital Q"
Width: 4px
ScapR Hex: 52
Name: "Capital R"
Width: 4px
ScapS Hex: 53
Name: "Capital S"
Width: 4px
ScapT Hex: 54
Name: "Capital T"
Width: 4px
ScapU Hex: 55
Name: "Capital U"
Width: 4px
ScapV Hex: 56
Name: "Capital V"
Width: 4px
ScapW Hex: 57
Name: "Capital W"
Width: 4px
ScapX Hex: 58
Name: "Capital X"
Width: 4px
ScapY Hex: 59
Name: "Capital Y"
Width: 4px
ScapZ Hex: 5A
Name: "Capital Z"
Width: 4px
Stheta Hex: 5B
Name: "Theta"
Width: 4px
Sbackslash Hex: 5C
Name: "Backslash"
Width: 4px
SrBrack Hex: 5D
Name: "Right Bracket"
Width: 3px
Scaret Hex: 5E
Name: "Caret"
Width: 4px
Sunderscore Hex: 5F
Name: "Underscore"
Width: 4px
Sbackquote Hex: 60
Name: "Backquote"
Width: 3px
SmallA Hex: 61
Name: "Small A"
Width: 4px
SmallB Hex: 62
Name: "Small B"
Width: 4px
SmallC Hex: 63
Name: "Small C"
Width: 4px
SmallD Hex: 64
Name: "Small D"
Width: 4px
SmallE Hex: 65
Name: "Small E"
Width: 4px
SmallF Hex: 66
Name: "Small F"
Width: 3px
SmallG Hex: 67
Name: "Small G"
Width: 4px
SmallH Hex: 68
Name: "Small H"
Width: 4px
SmallI Hex: 69
Name: "Small I"
Width: 2px
SmallJ Hex: 6A
Name: "Small J"
Width: 4px
SmallK Hex: 6B
Name: "Small K"
Width: 4px
SmallL Hex: 6C
Name: "Small L"
Width: 3px
SmallM Hex: 6D
Name: "Small M"
Width: 6px
SmallN Hex: 6E
Name: "Small N"
Width: 4px
SmallO Hex: 6F
Name: "Small O"
Width: 4px
SmallP Hex: 70
Name: "Small P"
Width: 4px
SmallQ Hex: 71
Name: "Small Q"
Width: 4px
SmallR Hex: 72
Name: "Small R"
Width: 4px
SmallS Hex: 73
Name: "Small S"
Width: 3px
SmallT Hex: 74
Name: "Small T"
Width: 3px
SmallU Hex: 75
Name: "Small U"
Width: 4px
SmallV Hex: 76
Name: "Small V"
Width: 4px
SmallW Hex: 77
Name: "Small W"
Width: 6px
SmallX Hex: 78
Name: "Small X"
Width: 4px
SmallY Hex: 79
Name: "Small Y"
Width: 4px
SmallZ Hex: 7A
Name: "Small Z"
Width: 5px
SlBrace Hex: 7B
Name: "Left Brace"
Width: 4px
Sbar Hex: 7C
Name: "Vertical Bar"
Width: 2px
SrBrace Hex: 7D
Name: "Right Brace"
Width: 4px
Stilde Hex: 7E
Name: "Tilde"
Width: 5px
SinvEQ Hex: 7F
Name: "Inverse Equal To"
Width: 4px
Ssub0 Hex: 80
Name: "Subscript 0"
Width: 4px
Ssub1 Hex: 81
Name: "Subscript 1"
Width: 3px
Ssub2 Hex: 82
Name: "Subscript 2"
Width: 4px
Ssub3 Hex: 83
Name: "Subscript 3"
Width: 4px
Ssub4 Hex: 84
Name: "Subscript 4"
Width: 4px
Ssub5 Hex: 85
Name: "Subscript 5"
Width: 4px
Ssub6 Hex: 86
Name: "Subscript 6"
Width: 4px
Ssub7 Hex: 87
Name: "Subscript 7"
Width: 4px
Ssub8 Hex: 88
Name: "Subscript 8"
Width: 4px
Ssub9 Hex: 89
Name: "Subscript 9"
Width: 4px
ScapAAcute Hex: 8A
Name: "Capital A Acute"
Width: 5px
ScapAGrave Hex: 8B
Name: "Capital A Grave"
Width: 5px
ScapACaret Hex: 8C
Name: "Capital A Caret"
Width: 5px
ScapADier Hex: 8D
Name: "Capital A Diaeresis"
Width: 5px
SaAcute Hex: 8E
Name: "Small A Acute"
Width: 5px
SaGrave Hex: 8F
Name: "Small A Grave"
Width: 5px
SaCaret Hex: 90
Name: "Small A Caret"
Width: 5px
SaDier Hex: 91
Name: "Small A Diaeresis"
Width: 5px
ScapEGrave Hex: 92
Name: "Capital E Grave"
Width: 5px
ScapEAcute Hex: 93
Name: "Capital E Acute"
Width: 5px
ScapECaret Hex: 94
Name: "Capital E Caret"
Width: 4px
ScapEDier Hex: 95
Name: "Capital E Diaeresis"
Width: 4px
SeAcute Hex: 96
Name: "Small E Acute"
Width: 4px
SeGrave Hex: 97
Name: "Small E Grave"
Width: 4px
SeCaret Hex: 98
Name: "Small E Caret"
Width: 4px
SeDier Hex: 99
Name: "Small E Diaeresis"
Width: 4px
ScapIAcute Hex: 9A
Name: "Capital I Acute"
Width: 4px
ScapIGrave Hex: 9B
Name: "Capital I Grave"
Width: 4px
ScapICaret Hex: 9C
Name: "Capital I Caret"
Width: 4px
ScapIDier Hex: 9D
Name: "Capital I Diaeresis"
Width: 4px
SiAcute Hex: 9E
Name: "Small I Acute"
Width: 4px
SiGrave Hex: 9F
Name: "Small I Grave"
Width: 4px
SiCaret Hex: A0
Name: "Small I Caret"
Width: 4px
SiDier Hex: A1
Name: "Small I Diaeresis"
Width: 4px
ScapOAcute Hex: A2
Name: "Capital O Acute"
Width: 6px
ScapOGrave Hex: A3
Name: "Capital O Grave"
Width: 6px
ScapOCaret Hex: A4
Name: "Capital O Caret"
Width: 6px
ScapODier Hex: A5
Name: "Capital O Diaeresis"
Width: 6px
SoAcute Hex: A6
Name: "Small O Acute"
Width: 6px
SoGrave Hex: A7
Name: "Small O Grave"
Width: 6px
SoCaret Hex: A8
Name: "Small O Caret"
Width: 6px
SoDier Hex: A9
Name: "Small O Diaeresis"
Width: 6px
ScapUAcute Hex: AA
Name: "Capital U Acute"
Width: 4px
ScapUGrave Hex: AB
Name: "Capital U Grave"
Width: 4px
ScapUCaret Hex: AC
Name: "Capital U Caret"
Width: 4px
ScapUDier Hex: AD
Name: "Capital U Diaeresis"
Width: 4px
SuAcute Hex: AE
Name: "Small U Acute"
Width: 5px
SuGrave Hex: AF
Name: "Small U Grave"
Width: 5px
SuCaret Hex: B0
Name: "Small U Caret"
Width: 5px
SuDier Hex: B1
Name: "Small U Diaeresis"
Width: 5px
ScapCCed Hex: B2
Name: "Capital C Cedilla"
Width: 4px
ScCed Hex: B3
Name: "Small C Cedilla"
Width: 4px
ScapNTilde Hex: B4
Name: "Capital N Tilde"
Width: 5px
SnTilde Hex: B5
Name: "Small N Tilde"
Width: 5px
Saccent Hex: B6
Name: "Accent"
Width: 3px
Sgrave Hex: B7
Name: "Grave"
Width: 3px
Sdieresis Hex: B8
Name: "Diaeresis"
Width: 4px
SquesDown Hex: B9
Name: "Inverted Question Mark"
Width: 4px
SexclamDown Hex: BA
Name: "Inverted Exclamation Mark"
Width: 2px
Salpha Hex: BB
Name: "Small Alpha"
Width: 5px
Sbeta Hex: BC
Name: "Small Beta"
Width: 4px
Sgamma Hex: BD
Name: "Small Gamma"
Width: 5px
ScapDelta Hex: BE
Name: "Capital Delta"
Width: 6px
Sdelta Hex: BF
Name: "Small Delta"
Width: 4px
Sepsilon Hex: C0
Name: "Small Epsilon"
Width: 4px
SlBrack Hex: C1
Name: "Left Bracket"
Width: 3px
Slambda Hex: C2
Name: "Small Lambda"
Width: 4px
Smu Hex: C3
Name: "Small Mu"
Width: 5px
Spi Hex: C4
Name: "Small Pi"
Width: 6px
Srho Hex: C5
Name: "Small Rho"
Width: 5px
ScapSigma Hex: C6
Name: "Capital Sigma"
Width: 5px
Ssigma Hex: C7
Name: "Small Sigma"
Width: 5px
Stau Hex: C8
Name: "Small Tau"
Width: 5px
Sphi Hex: C9
Name: "Small Phi"
Width: 6px
ScapOmega Hex: CA
Name: "Capital Omega"
Width: 6px
SxMean Hex: CB
Name: "X Mean"
Width: 4px
SyMean Hex: CC
Name: "Y Mean"
Width: 4px
SsupX Hex: CD
Name: "Superscript X"
Width: 4px
Sellipsis Hex: CE
Name: "Ellipsis"
Width: 3px
Sleft Hex: CF
Name: "Left Pointing Triangle"
Width: 4px
Sblock Hex: D0
Name: "Block"
Width: 3px
Sper Hex: D1
Name: "Per"
Width: 4px
Shyphen Hex: D2
Name: "Hyphen"
Width: 3px
Sarea Hex: D3
Name: "Area"
Width: 4px
Stemp Hex: D4
Name: "Temperature"
Width: 4px
Scube Hex: D5
Name: "Cube"
Width: 4px
Senter Hex: D6
Name: "Enter"
Width: n/a
SimagI Hex: D7
Name: "Imaginary I"
Width: 4px
Sphat Hex: D8
Name: "P Hat"
Width: 4px
Schi Hex: D9
Name: "Small Chi"
Width: 4px
SstatF Hex: DA
Name: "Stat F"
Width: 4px
Slne Hex: DB
Name: "Natural Logarithm E"
Width: 4px
SlistL Hex: DC
Name: "List Capital L"
Width: 3px
SfinanN Hex: DD
Name: "Finance Capital N"
Width: 3px
S2_r_paren Hex: DE
Name: "Two Right Parentheses"
Width: 4px
SnarrowCapE Hex: DF
Name: "Narrow Capital E"
Width: 3px
SListLock Hex: E0
Name: "List Lock"
Width: 3px
Sscatter1 Hex: E1
Name: "Scatter 1"
Width: 6px
Sscatter2 Hex: E2
Name: "Scatter 2"
Width: 5px
Sxyline1 Hex: E3
Name: "xyLine 1"
Width: 6px
Sxyline2 Hex: E4
Name: "xyLine 2"
Width: 5px
Sboxplot1 Hex: E5
Name: "Boxplot 1"
Width: 6px
Sboxplot2 Hex: E6
Name: "Boxplot 2"
Width: 5px
Shist1 Hex: E7
Name: "Histogram 1"
Width: 6px
Shist2 Hex: E8
Name: "Histogram 2"
Width: 5px
SmodBox1 Hex: E9
Name: "ModBoxplot 1"
Width: 6px
SmodBox2 Hex: EA
Name: "ModBoxplot 2"
Width: 5px
Snormal1 Hex: EB
Name: "NormProbPlot 1"
Width: 6px
Snormal2 Hex: EC
Name: "NormProbPlot 2"
Width: 5px
STwoSpaces Hex: ED
Name: "Two Spaces"
Width: 2px
SThreeSpaces Hex: EE
Name: "Three Spaces"
Width: 3px
SFiveSpaces Hex: EF
Name: "Five Spaces"
Width: 5px
SSixSpaces Hex: F0
Name: "Six Spaces"
Width: 6px
ScurFull Hex: F1
Name: "Cursor Full"
Width: 4px
Sdollar Hex: F2
Name: "Dollar Sign"
Width: 6px
SsqUp Hex: F3
Name: "Square Up"
Width: 5px
SsharpS Hex: F4
Name: "Sharp S"
Width: 5px
SMPmixedFrac Hex: F5
Name: "MathPrint Mixed Fraction Separator"
Width: 4px
SMPfracSlash Hex: F6
Name: "MathPrint Fraction Slash"
Width: 4px
SMPentryBox Hex: F7
Name: "MathPrint Entry Box"
Width: 6px
Name: Little Man Computer Emulator LMC v1.0
Author: Rick Skrbina
Download: LMC Emulator.zip
Compatibility: Parent page not set
File Size: 1,144 Bytes
The Little Man Computer was designed to teach students how computers work and about assembly language. This is a Little Man Computer emulator for your TI 83. It runs pure LMC machine code with 100% accuracy and full speed. The only difference form this emulator from the real LMC is that this emulator only has 99 mailboxes instead of 100. This is a great program for you if you ever want to learn assembly language.

author: 'TI-Basic Developer'
description: 'You have to chase down the randomly moving target.'
arcade: '1'
graphics: '0'
platform: '0'
puzzle: '0'
rpg: '0'
strategy: '0'
sports: '0'
casino: '0'
board: '0'
utility: '0'
misc: '0'
image: /home/no_image_2.png
download: chase.zip
size: '210'
unit: '1'

Name: Maze Walkthrough
Author: TI-Basic Developer
Download: MazeWalkthrough.zip
Compatibility: Parent page not set
File Size: 244 Bytes
You have to make your way through the maze without touching any of the walls.
Name: Simon Says
Author: TI-Basic Developer
Download: SimonSays.zip
Compatibility: Parent page not set
File Size: 214 Bytes
You must repeat a pattern which gets longer and longer.
Name: Fly The Copter
Author: Weregoose
Download: FlyTheCopter.zip
Compatibility: Parent page not set
File Size: 356 Bytes
You have to navigate a scrolling tunnel for as long as possible.
Name: Hop Over
Author: Weregoose
Download: HopOver.zip
Compatibility: Parent page not set
File Size: 400 Bytes
You have to move the pieces around until you get the four squares on the left and the four crosshairs on the right.
Name: Demented Snake
Author: TI-Basic Developer
Download: DementedSnake.zip
Compatibility: Parent page not set
File Size: 289 Bytes
Just like snake, except you need to constantly change directions to keep the snake moving fast.
Name: Rock Paper Scissors
Author: TI-Basic Developer
Download: RockPaperScissors.zip
Compatibility: Parent page not set
File Size: 296 Bytes
You have three different hand gestures to choose from, but can you choose the best hand…
Name: Hangman
Author: TI-Basic Developer
Download: Hangman.zip
Compatibility: Parent page not set
File Size: 444 Bytes
Alternate turns trying to guess a word by selecting the letters that make up the word until the word is correctly guessed or you run out of chances.

author: 'TI-Basic Developer'
description: 'A simple "card" game where you flip over two cards each turn to try to get a matching pair.'
arcade: '0'
graphics: '0'
platform: '0'
puzzle: '1'
rpg: '0'
strategy: '0'
sports: '0'
casino: '0'
board: '0'
utility: '0'
misc: '0'
image: /home/no_image_2.png
download: memory.zip
size: '389'
unit: '1'

Name: Snake
Author: TI-Basic Developer
Download: Snake.zip
Compatibility: Parent page not set
File Size: 268 Bytes
Go around eating food, and the snake grows longer and longer with each piece of food.
Name: Avalanche
Author: TI-Basic Developer
Download: Avalanche.zip
Compatibility: Parent page not set
File Size: 301 Bytes
Avoid the falling spikes by moving to the left or right, trying to see how long you can hold out for.
Name: Tic Tac To
Author: TI-Basic Developer
Download: TicTacTo.zip
Compatibility: Parent page not set
File Size: 277 Bytes
Alternate turns placing pieces on the 3x3 game board until somebody gets 3-in-a-row or all nine spots on the game board are filled.
Name: Darts
Author: TI-Basic Developer
Download: Darts.zip
Compatibility: Parent page not set
File Size: 298 Bytes
Hit the target with your dart, while avoiding the obstacles in your way.
Name: Guess the Number
Author: TI-Basic Developer
Download: NumberGuess.zip
Compatibility: Parent page not set
File Size: 215 Bytes
Try to guess the number, and see how many tries it takes you.
Name: Mine Field
Author: TI-Basic Developer
Download: Minefield.zip
Compatibility: Parent page not set
File Size: 239 Bytes
Like the classic game minesweeper, the goal is to avoid hitting the mines.
Name: Pong
Author: TI-Basic Developer
Download: Pong.zip
Compatibility: Parent page not set
File Size: 176 Bytes
You have to keep the ball in play by bouncing it back and forth against the walls, without letting it get by your paddle.

The term "graph" is ambiguous and may refer to:

  • Graph Screen, the screen where equations are graphed and graphics are displayed.
  • Graphstyle(, sets the graphing style of a graphing equation in the current mode.
  • Graph Mode, the mode the calculator uses when graphing equations.

If an internal link led you here, you may wish to change the link to point directly to the intended article.

Routine Summary

Makes text appear letter by letter

Inputs

Str1 - Text to be displayed.
A,B - Row and colum to display text.

Variables Used

A, B, T, Str1

Calculator Compatibility

All TI calculators

:For(T,1,length(Str1
:Text(A,B,sub(Str1,1,T
:rand(5
:End

We use a For( loop over the length of the string to go through the string letter by letter. In order to make the spacing come out right, instead of figuring out the right coordinate to display each character at, we display the first T characters of the string starting from the beginning. The rand(5) provides a split-second delay to achieve the typewriter effect.

For multiple lines with the typewriter effect, you can combine this routine with the one to wordwrap text.

Error Conditions

  • ERR:DOMAIN is thrown if the string doesn't fit entirely on the screen.

Related Routines

Recent Forum Posts

it doesn't have a cpu cache, but the fixed location in ram can sometimes be referenced as a ram...
(by Trenly 20 Sep 2018 23:11, posts: 6)
The TI-83+ series doesn't have a cache. The difference is that system vars are in a fixed...
(by lirtosiast 20 Sep 2018 22:56, posts: 6)
System vars will always be faster. Because system vars are loaded into memory anytime the system...
(by Trenly 20 Sep 2018 21:30, posts: 6)

Recent Forum Threads

(Started 18 Sep 2018 23:30, Posts: 1)
(Started 18 Sep 2018 22:40, Posts: 2)
(Started 18 Sep 2018 02:30, Posts: 2)
(Started 17 Sep 2018 20:30, Posts: 0)
(Started 17 Sep 2018 01:10, Posts: 10)

We are excited that you have chosen to visit our site, and firmly believe that you will not only leave as a better TI-Basic programmer, but that you will come to see the site as your TI-Basic home!

You will find that this community was designed to be a friendly and welcoming environment, and we are dedicated to providing information and discussion to anyone interested in TI-Basic.

Whether you are just starting out in programming or you are already an accomplished TI-Basic programmer, you are welcome to join our community.

Site Features

The site offers a rich assortment of features, and we encourage you to explore it at your own pace:

Where to Begin?

When you feel comfortable, we invite you to get involved on the site. Registration is a simple two-step process and involves creating a Wikidot account and then going to the join page to join the site. It is quick and painless, and should take no more than a couple minutes. We then encourage you to introduce yourself to the community so that we can get to know you better. We also suggest reading the rules, as well as the how-to page, as both contain information you will want to know.

The forums are where much of the community activity takes place, so you will want to regularly visit to see what's new. They are conveniently separated into different categories based on the types of discussions they contain, including site discussion, general discussion, programming & design, and projects & contests.

You will also want to enable the watching feature by clicking the "start watching" link in the bottom page options toolbar. This allows you to follow changes on the whole site, just the forum, or a particular page, and you will be notified via email whenever someone alters it or adds a comment to it. Watching can be enabled/disabled in the activities settings of your Wikidot account.

You can navigate the site by using the links in the navigation bar at the top of the page, or by going to the sitemap for a hierarchical view. The home link is accessible on the other pages by clicking the respective link in the top navigation, and you can search the site by using the search box at the top right of the page. You will find the search box to be an invaluable tool to locate information from pages and old posts in the forums.

Contact Information

If you wish to contact the administrators for any reason, you have a few different routes you can take:

  • Create a Wikidot account and send a private message (PM) to the administrator of your choice. Just click on the arrow at the top right corner and select "private messages".
  • Find the email address of each administrator on their profile page and send them an email with your question. Of course, this only works if the administrator lists their email address.
  • Start a new topic in the discussion forums. This method works well if you don't care which administrator responds, but you should know that everyone can see this forum. If you have a personal question you want to ask, sending a PM is the way to go.

We will try to respond in a timely manner, hopefully in a day or two. Please just be patient.


We hope that you enjoy using the site and stop by often.

Thanks for visiting!

The TI-Basic Developer Community

author: Mapar007
description: "Data storage system with personal sheets and bookmark codes.\n\nThe second version of Mnemon."
arcade: '0'
graphics: '0'
platform: '0'
puzzle: '0'
rpg: '0'
strategy: '0'
sports: '0'
casino: '0'
board: '0'
utility: '1'
misc: '0'
image: '/archives:mnemon2/mnemon2.jpg'
download: mnemon_2.5.zip
size: '2453'
unit: '1'

The abbreviation "asm" is ambiguous and may refer to:

  • Asm(, the command used for running a shell-independent assembly program.
  • Assembly, the other programming language available on the TI graphing calculators.

If an internal link led you here, you may wish to change the link to point directly to the intended article.

The ListPages module does not work recursively.

Horizontal Sprites

Explanation

In order to create a text sprite, one must have a series of characters and each character returns a certain number of pixels in certain arrangement on the graphscreen. Each character, when displayed on the graphscreen will return certain pixels in its first column of text. For example, if one displayed the letter "J" to the graphscreen it would look like this: (0 = empty pixel, 1 = filled pixel)

001
001
001
101
111

The first column of text is therefore "00011." The value, 00011b, (in binary) is equivalent to the decimal value 3. Each character, when displayed on the graphscreen will such a number associated with it. Therefore it is easy to organize all the possible text sprites numerically.

You can create rows of text spites this way. You could then stack these rows up from bottom to top to fill large portions of the screen. An important thing to remember though, is that vertical text sprites are much faster for larger images. They can fill the entire screen in just 4 seconds on an 84!

Chart

This chart contains the best characters to use for each pixel combination when drawing a text sprite:

  1. Each is at most three pixels wide (not counting the 1-pixel margin to the left of each character).
  2. When possible, they are 1-byte characters, or if not, at least commonly accessible.
Char. Binary Decimal Char. Binary Decimal
space 00000b 0 ? 10000b 16
. 00001b 1 ] 10001b 17
0Bh_LcrossIcon.gif mark 00010b 2 2 10010b 18
J 00011b 3 2 10011b 19
+ 00100b 4 x 10100b 20
í 00101b 5 $\definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} \overline{\mathrm{x}}$ 10101b 21
e 00110b 6 û 10110b 22
0Ah_LboxIcon.gif mark 00111b 7 $\definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} i$ 10111b 23
^ 01000b 8 Y 11000b 24
1 01001b 9 Î 11001b 25
: 01010b 10 $\definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} \chi$ 11010b 26
none 01011b 11 X 11011b 27
º 01100b 12 ' 11100b 28
s 01101b 13 ! 11101b 29
( 01110b 14 Q 11110b 30
u 01111b 15 [ 11111b 31

Vertical Sprites

Differences with horizontal sprites

The main difference for a vertical sprite is that you need only one text( command to fill an entire horizontal line. It has a noticeable advantage on horizontal sprites when sprites are larger. It is not only faster but you are not limited to a 5x5 sprite or a 7x7 sprite. Also, you don't use a picture variable which can be more convenient in some situations. You don't need to group Pics and your program in order to send it to someone.
In order to draw a sprite, you must draw from bottom to top in order to not erase what is already written. The main disadvantage is that only ∟ , N and … don't end with a 0. But it really doesn't matter, because you can make any vertical sprite using only the ., [, and the ∟. In conclusion, if you need to draw large sprites or even to fill the graphscreen, you should use vertical sprites, otherwise horizontal sprites are for you.

:Text(9,1,"1
:Text(8,1,"Δ
:Text(7,1,"Ω
:Text(6,1,"Δ
:Text(5,1," 1
:Text(4,1,"     //5 spaces

Chart

This chart contains characters from 1 to 6 pixels wide. A 0 represents an empty pixel while a 1 is for a black pixel. If you need a character larger than 6 pixels wide, you can search in Weregoose database here.

Char. Binary Char. Binary Char. Binary Char. Binary
space 0 - 0000 07h_LsqDown.gif 00100 * 001000
: 00 4 0010 σ 01000 010000
. 10 0 0100 û 01010 w 010100
` 000 { 0110 É 01110 @ 011100
( 010 F 1000 μ 10000 m 100010
) 100 A 1010 ñ 10010 n 100100
N 101 } 1100 ß 10100 10 101110
[ 110 1 1110 È 11100 Ω 110110
111 ° 00000 z 11110 $ 111100
Δ 111110

Also see

Text Sprite Finder - this program is a compact version of what is on this page, this page simply explains how this program fundamentally works.
Vertical Sprites Bottom Row - to have a complete database with the bottom row of all TI-83/84/+/SE characters.
Graphics - for information on using text sprites.
Binary and Hexidecimal - to understand how to read the binary format.
TI-83 Plus Large Font - for clarification on which characters are being referred to.
CHARS.8xp - A program that contains many otherwise unobtainable characters.
Text Sprite Generator - A drawing program that outputs the text sprite code to display the sprite.

If you have ever played any of the snake, mofrog, nibbles, etc. games, then this game should be familiar to you. The basic premise is to go around eating food and the snake grows longer with each piece of food. However, this snake game has an additional element to it: you need to constantly change directions to keep the snake moving fast. Like with the other games, try out the game and try to understand and think through the code.

Table of Contents

The Code

:26-2int(2rand→K
:{4→L1:Ans→L2:1→I
:ClrHome
:For(J,1,E2
:L1(1→L1(J
:L2(1→L2(J
:Repeat max(S≠L1 and Ans≠L2
:randInt(1,8→S
:randInt(1,16→T
:End
:Output(S,Ans,"*
:Repeat T=Ans and S=L1(I
:getKey
:If Ans=45:Goto Q
:If Ans=34 or 2>abs(Ans-25:Ans→K
:I+1-J(I=J→I
:Output(L1(Ans),L2(Ans),"  // 1 space
:(K=34)-(K=25)+L1(Ans-(Ans>1
:Ans+8(not(Ans)-(Ans=9→L1(I
:(K=26)-(K=24)+L2(I-(I>1
:Ans+16(not(Ans)-(Ans=17→L2(I
:Output(L1(I),Ans,"O
:End:End
:Lbl Q
:ClrHome:J

The Download

In case you want to try the program on your calculator, you can download the program in .8xp format.

Whee! You got through the first part of the starter kit! Now, we come to the second part, which will get into the finer points of the homescreen and data types.
We will start off the second part of the kit by discussing more of the homescreen. Let's begin, shall we?

Letting the User See Something

Back in the first part, you only learned of one command that can display information, the Disp command. We will learn two more commands that deal with output, starting with the ClrHome command.

ClrHome

The ClrHome command clears the homescreen, giving you an empty space to work with. No arguments are needed, just select it from the I/O menu of the PRGM button (only accessible this way while editing).

Two Notes

  1. Output( will write over anything on the homescreen
  2. Disp, Input, and Prompt will not recognize Output( commands, so if you have some text printed at 1,1 and then use Input, you will write over the Output(

Output

The Output( command lets you print text, just like the Disp command. There are two differences, though: You can choose where to start the text, and strings that go off the end of the screen will wrap around to the next line!
To use it, you need three arguments: the row where the first character appears, the column, and the text.
You use it like so:

:Output(8,1,"PRESS ENTER")

This text starts at the bottom-left corner of the screen, and prints PRESS ENTER.
The most useful application for Output( is to dynamically update the home screen. If you had money in the top left corner and life in the bottom left for a game, using Disp to update those would be a pain. You would have the un-updated text blink, because you had to ClrHome first. Output allows you to avoid the flicker.

Making the Program Smart

In the past, you only knew of the Input command for input. Now we will cover two more input methods, the first being Prompt.

Prompt

Prompt is a much more primitive command than Input, but it gets the job done. It only needs one argument: the variable. You can add more variables to one Prompt statement, as long as they are separated by commas. Here is a basic use:

Prompt A

The code will show A=?, which means, "What do you want A to equal?". Prompt has limitations, and quality programs are unlikely to use it because the A=? thing doesn't look very professional.
The limitations are outlined below:
  • Cryptic - Prompt doesn't allow custom text to be displayed, unlike Input. The casual calculator user can be intimated by the cryptic look that is forced.
  • No Exception - If you want someone to enter a string using Prompt, the user must put quotation marks around the string or risk error. Input doesn't care.

Final Notes

These are the last of the commands that can directly influence the home screen. The furthest from direct influence is getKey, which you will discover in detail in the next lesson. More on the commands you just learned can be found on their respective pages. Try searching for them in the upper right hand corner of the site!
Hopefully you can use the homescreen commands well. Next up we explore the hidden elements of input: data types, and the getKey command.

<< Sample Program: Guessing Game Table of Contents Using getKey >>
Name: Vortex
Author: Builderboy2005
Download: Vortex.zip
Compatibility: Parent page not set
File Size: 3,964 Bytes
Vortex is a fun, challenging, turn-based multiplayer strategy game. The object of the game is to kill your opponent. You can go around collecting boxes of money and use them to buy upgrades, items, and weapons. The game also features a random level generator. Fully MirageOS compatible.

Matrices are a step up from lists. Lists are a string of elements, like {5,4,3,2,1,0}. A matrix, on the other hand, is a list of lists, like [[5,5,5],[4,4,4],[3,3,3],[2,2,2]]. Below, we will start learning how to handle this more complex data type.

Setting up Matrices

Unfortunately, unlike lists, there is no SetUpEditor command to make it easy for matrices. Fortunately, though, matrices [A] through [J] always exist, unless otherwise removed. This gets rid of the need to dim( first. You do need to be careful with UnArchive. To ask if the user has already run the program, you could use a routine such as the following:

:Menu("CONTINUE?","YES",Y,"NO",N)
:Lbl Y
:UnArchive [J]
:Lbl N
:{2,3}→dim([J])

What does that last line of code do? Well, this is just like setting the size of lists in the last lesson. The only difference is that we need to have two numbers that are separated by a comma and surrounded by curly braces. The last line of code above says to give matrix [J] 2 rows and 3 columns. If you prefer to think of matrices as lists of lists, you can say that the last line of code says, "Provide 2 lists, each with 3 elements."

Using Matrices

Writing

It is really simple to store an element into a matrix. To store the number 5 into row 1 and column 2 of our matrix [J], we use this line:

:5→[J](1,2)

Simple, right? What if you want to store the powers of 2 from element (1,1) to (2,3)? We have to use this code:

:{2,3}→dim([J])
:0→P
:For(R,1,2)
:For(C,1,3)
:P+1→P
:2^P→[J](R,C)
:End
:End

Notice how it is a lot more complicated than the version with the list. This is because we first start the For( loop for both rows of our matrix, and then within that we start the For( loop for every column of the current row.

Reading

Let's make this simple. To store a matrix element to a variable, use this line of code:

:[J](1,2)→A

This stores element (1,2) of [J] into the real variable A.
To display it, use this line:

:Disp [J](1,2)

Now, let's modify our program to show some results.

:ClrHome
:{2,3}→dim([J])
:0→P
:For(R,1,2)
:For(C,1,3)
:P+1→P
:2^P→[J](R,C)
:Disp [J](R,C)
:End
:End

We've added a ClrHome command to the beginning, and a Disp command above the two Ends. If you do it right, your output should be:

2
4
8
16
32
64
Done

Cleaning Up

Fortunately, you just need to use the Archive command for a matrix to be archived.

Final Notes

Now, you see how much more powerful a matrix is, when coming from a list. Matrices are usually used to store map data and such. Still, the bigger step up is the string data type. This is the most powerful variable type, and you will learn about it next.

<< Data Types (lists) Table of Contents Data Types (strings) >>
Name: Portal
Author: Builderboy
Download: Portal.zip
Compatibility: Parent page not set
File Size: 9,405 Bytes
In Portal, you are a test subject at The Aperture Science Enrichment Program and are testing The recent invention of the Portal Gun! Yay! It allows you to shoot portals and move between them. Those who have played the official version will remember GlaDos… And she's back in the calculator version! GlaDOS is your narrator and guide and is the one that will monitor all your tests. But when the tests are over… Watch out! the game isn't over yet…
Name: Minigame Party
Author: 7thAce
Download: Minigame-Party.zip
Compatibility: Parent page not set
File Size: 7,856 Bytes
This is a game package. There are 4 games in there now, and 4 more will be coming. Press 2nd to play them all in order. Just read the readme :)
Name: Mnemon
Author: Mapar007
Download: Mnemon.zip
Compatibility: Parent page not set
File Size: 1,073 Bytes

This is a program to create data sheets and read them. You must input a random code of 6 letters/numbers which form your personal ID. It will mace secure that nobody else can read your data sheets on their calculator!

(note:do not pick MNEMON as a code, unless you want everyone to be able to read your files!)

Name: Move
Author: Mapar007
Download: Move.zip
Compatibility: Parent page not set
File Size: 2,674 Bytes
Game in which you must collect O's with an X without stepping the *'s
Name: Bunny Gotchi
Author: James Kanjo
Download: BunnyGotchi_1-7.zip
Compatibility: Parent page not set
File Size: 6,637 Bytes

Bunny Gotchi is a virtual pet (a bunny rabbit) on your calculator. Bunny Gotchi is one of the few "Tamagotchi" programs available to the TI-83plus, and fewer still containing animations. It will challenge your efforts to keep it alive, healthy and happy!

Version 1.7 is architecturally identical to version 1.6, but is 483 bytes smaller.

[[include inc:tablet
|name=
|author=
|size=
|description=

|picture=
|downloadUrl=
|downloadName=
]]

|name=

Type in the name of the program.

|author=

Type in the name of the Author. Alternatively, you can include a URL link to the author's page by typing in: [URL Author's Name]

|size=

Type in the size of the program as it appears on the calculator. Make sure to include any subprograms, variables, pictures, or anything else that is included with the program.

  • If the program size is under 20,000 bytes, use bytes: 17,235 Bytes
  • If the program size is over 20,000 bytes, use KB: 23KB

|description=

Enter a brief description about the program.

|picture=

Type in: FULL-URL

If nothing is entered, a default image will appear instead.

|downloadUrl=

Type in the full URL of the program file.

|downloadName=

Type in the name that you want to appear for the program file's download: File.zip.

Name: No name given
Author: No author given
Download: Download Unavailable
Compatibility: Parent page not set
File Size: No size given
No description given

author: 'Robert Moy (Harrierfalcon)'
description: 'Metroid Pi is a pure TI-Basic version of the classic Metroid game, with the game following the standard storyline of making your way through several increasingly difficult areas, while battling enemies, bosses, and getting powerups that allow you to beat the next area in the game.'
arcade: '0'
graphics: '0'
platform: '1'
puzzle: '0'
rpg: '1'
strategy: '0'
sports: '0'
casino: '0'
board: '0'
utility: '0'
misc: '0'
image: /metroid-pi/metroidpi.gif
download: metroidpi.zip
size: '17016'
unit: '1'

Name: {$name}
Author: {$author}
Download: [{$downloadUrl} {$downloadName}]
Compatibility: {$compatibility}
File Size: {$size}
{$description}
Name: Donut Quest
Author: Mikhail Lavrov (DarkerLine)
Download: DonutQuest.zip
Compatibility: Parent page not set
File Size: 10,154 Bytes
Donut Quest is a TI-Basic game of revolutionary quality. It uses no libraries of any kind, in fact, you don't need anything other than the game program to play it. On each of eight levels, you must get to (and eat) all the donuts, then leave through an exit (unless given other instructions).

Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of symbols used to represent numbers. In the decimal system, we use ten different symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. With these ten symbols, we can represent any quantity. For example, if we see a 2, then we know that there is two of something. For example, this sentence has 2 periods on the end..

When we run out of symbols, we go to the next digit placement. To represent one higher than 9, we use 10 meaning one unit of ten and zero units of one. This may seem elementary, but it is crucial to understand our default number system if you want to understand other number systems.

For example, when we consider a binary system which only uses two symbols, 0 and 1, when we run out of symbols, we need to go to the next digit placement. So, we would count in binary 0, 1, 10, 11, 100, 101, and so on.

This article will discuss the binary, hexadecimal, and octal number systems in more detail and explain their uses.

How a Number System Works

Number systems are used to describe the quantity of something or represent certain information. Because of this, I can say that the word "calculator" contains ten letters. Our number system, the decimal system, uses ten symbols. Therefore, decimal is said to be Base Ten. By describing systems with bases, we can gain an understanding of how that particular system works.

When we count in Base Ten, we count starting with zero and going up to nine in order.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …

Once we reach the last symbol, we create a new placement in front of the first and count that up.

8, 9, 10, 11, 12, … , 19, 20, …


This continues when we run out of symbols for that placement. So, after 99, we go to 100.

The placement of a symbol indicates how much it is worth. Each additional placement is an additional power of 10. Consider the number of 2853. We know this number is quite large, for example, if it pertains to the number of apples in a basket. That's a lot of apples. How do we know it is large? We look at the number of digits.

Each additional placement is an additional power of 10, as stated above. Consider this chart.
103 102 101 100
digit digit digit digit
*1000 *100 *10 *1

Each additional digit represents a higher and higher quantity. This is applicable for Base 10 as well as to other bases. Knowing this will help you understand the other bases better.

Binary

Binary is another way of saying Base Two. So, in a binary number system, there are only two symbols used to represent numbers: 0 and 1. When we count up from zero in binary, we run out of symbols much more frequently.

0, 1, …

From here, there are no more symbols. We do not go to 2 because in binary, a 2 doesn't exist. Instead, we use 10. In a binary system, 10 is equal to 2 in decimal.

We can count further.

Binary 0 1 10 11 100 101 110 111 1000 1001 1010
Decimal 0 1 2 3 4 5 6 7 8 9 10
Just like in decimal, we know that the more digits there are, the larger the number. However, in binary, we use powers of two. In the binary number 1001101, we can create a chart to find out what this really means.
26 25 24 23 22 21 20
1 0 0 1 1 0 1
64+0+0+8+4+0+1
77

Since this is base two, however, the numbers don't get quite as large as it does in decimal. Even still, a binary number with 10 digits would be larger than 1000 in decimal.


The binary system is useful in computer science and electrical engineering. Transistors operate from the binary system, and transistors are found in practically all electronic devices. A 0 means no current, and a 1 means to allow current. With various transistors turning on and off, signals and electricity is sent to do various things such as making a call or putting these letters on the screen.

Computers and electronics work with bytes or eight digit binary numbers. Each byte has encoded information that a computer is able to understand. Many bytes are stringed together to form digital data that can be stored for use later.

Octal

Octal is another number system with less symbols to use than our conventional number system. Octal is fancy for Base Eight meaning eight symbols are used to represent all the quantities. They are 0, 1, 2, 3, 4, 5, 6, and 7. When we count up one from the 7, we need a new placement to represent what we call 8 since an 8 doesn't exist in Octal. So, after 7 is 10.

Octal 0 1 2 3 4 5 6 7 10 11 12… 17 20… 30… 77 100
Decimal 0 1 2 3 4 5 6 7 8 9 10… 15 16… 24… 63 64

Just like how we used powers of ten in decimal and powers of two in binary, to determine the value of a number we will use powers of 8 since this is Base Eight. Consider the number 3623 in base eight.

83 82 81 80
3 6 2 3
1536+384+16+3
1939

Each additional placement to the left has more value than it did in binary. The third digit from the right in binary only represented 23-1, which is 4. In octal, that is 83-1 which is 64.

Hexadecimal

The hexadecimal system is Base Sixteen. As its base implies, this number system uses sixteen symbols to represent numbers. Unlike binary and octal, hexadecimal has six additional symbols that it uses beyond the conventional ones found in decimal. But what comes after 9? 10 is not a single digit but two… Fortunately, the convention is that once additional symbols are needed beyond the normal ten, letters are to be used. So, in hexadecimal, the total list of symbols to use is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. In a digital display, the numbers B and D are lowercase.

When counting in hexadecimal, you count 0, 1, 2, and so on. However, when you reach 9, you go directly to A. Then, you count B, C, D, E, and F. But what is next? We are out of symbols! When we run out of symbols, we create a new digit placement and move on. So after F is 10. You count further until you reach 19. After 19, the next number is 1A. This goes on forever.

Hexadecimal 9 A B C D E F 10 11… 19 1A 1B 1C… 9F A0
Decimal 9 10 11 12 13 14 15 16 17 25 26 27 28 159 160

Digits are explained as powers of 16. Consider the hexadecimal number 2DB7.

163 162 161 160
2 D B 7
8192+3328+176+7
11703

As you can see, placements in hexadecimal are worth a whole lot more than in any of the other three number systems.

Conversion

It is important to know that 364 in octal is not equal to the normal 364. This is just like how a 10 in binary is certainly not 10 in decimal. 10 in binary (this will be written as 102 from now on) is equal to 2. 108 is equal to 8. How on earth do we know this? What is 20C.38F16, and how do we find out?

Here is why it is important to understand how the number systems work. By using our powers of the base number, it becomes possible to turn any number to decimal and from decimal to any number.

Base to Decimal

So, we know that 3648 is not equal to the decimal 364. Then what is it? There is a simple method in converting from any base to the decimal base ten. If you remember how we dissected the numbers above, we used powers, such as 24, and ended up with a number we understand. This is exactly what we do to convert from a base to decimal. We find out the true value of each digit according to their placement and add them together.

In a formula, this algorithm looks like:

(1)
\begin{equation} V_{10} = v_pB^p+v_{p-1}B^{p-1}+...+v_1B+v_0 \end{equation}

Where V10 is the decimal value, v is the digit in a placement, p is the placement from the right of the number assuming the rightmost placement is 0, and B is the starting base. Do not be daunted by the formula! We are going to go through this one step at a time.

So, let us say we had the simple hexadecimal number 2B. We want to know what this number is in decimal so that we can understand it better. How do we do this?

Let us use the formula above. Define every variable first. We want to find V10, so that is unknown. The number 2B16 has two positions since it has two digits. p therefore is one less than that1, so p is 1. The number is in base 16, so B is 16. Finally, we want to know what v is, but there are multiple v's. You have v1 and v0. This refers to the value of the digit in the subscripted position. v1 refers to the digit in position one (the second digit from the right). So, v1 is 2. v0 is the first digit which is B. In the case of the conversion, you must convert all the letters to what they are in decimal. B is 11 in decimal, so v0 is 11.

Now, plug all this into the formula:

(2)
\begin{align} V_{10} = 2(16^1)+11(16^0) \\ V_{10} = 2(16)+11(1) \\ V_{10} = 32+11 \\ V_{10} = 43 \\ \end{align}

Therefore, 2B16 is equal to 43.

Now, let me explain how this works. Remember how digit placement affects the actual value? For example, in the decimal number 123, the "1" represents 100 which is 1*102. The "2" is 20, or 2*101. Likewise, in the number 2B16, the "2" is 2*161, and the B is 11*160.

We can determine the value of numbers in this way. For the number 3648, we will make a chart that exposes the decimal value of each individual digit. Then, we can add them up so that we have the whole. The number has three digits, so starting from the right, we have position 0, position 1, and position 2. Since this is base eight, we will use powers of 8.

82 81 80
3 6 4

Now, 82 is 64. 81 is 8. 80 is 1. Now what?

Remember what we did with the decimal number 123? We took the value of the digit times the respective power. So, considering this further…

3*64 6*8 4*1
192 48 4

Now, we add the values together to get 244. Therefore, 3648 is equal to 24410.

In the same way that for 123, we say there is one group of 100, two groups of 10, and three groups of 1, for octal and the number 364, there are three groups of 64, six groups of 8, and four groups of 1.

Decimal to Base

Just like how we can convert from any base to decimal, it is possible to convert decimal to any base. Let us say that we want to represent the number 23610 in binary, octal, and hexadecimal. What we need to do is pretty much reverse whatever we did above. There isn't really a good formula for this, but there is an algorithm that you can follow which will help accomplish what we want.

(3)
\begin{align} (1) \hspace{6pt} Let \hspace{4pt} P = \operatorname{int}(\sqrt[B]{V}) \\ (2) \hspace{6pt} Let \hspace{4pt} v = \operatorname{int}(V \div B^P) \\ (v \hspace{4pt} is \hspace{4pt} the \hspace{4pt} next \hspace{4pt} digit \hspace{4pt} to \hspace{4pt} the \hspace{4pt} right) \\ (3) \hspace{6pt} Make \hspace{4pt} V = V-vB^p \\ (4) \hspace{6pt} Repeat \hspace{4pt} steps \hspace{4pt} 1 \hspace{4pt} through \hspace{4pt} 3 \hspace{4pt} until \hspace{4pt} p=0 \\ \end{align}

This algorithm may look confusing at first, but let us go through an example to see how it can be used. We want to represent 236 in binary, octal, and hexadecimal. So, let's try getting it to binary first.

The first step is to make p equal to $\operatorname{int}(\sqrt[B]{V})$. B is the base we want to convert to which is 2. The V is the number we want to convert, 236. Essentially, we are taking the square root of 236 and disregarding the decimal part. Doing this makes p become 7.

Step two says to let v equal our number V divided by Bp. Bp is 27, or 128, and the integer part of 236 divided by 128 is 1. Therefore, our first digit on the left is 1. Now, we actually change V to become V minus the digit times the Bp. So, V will now be 236-128, or 108.

We simply repeat the process until the p becomes a zero. When p becomes zero, we complete the steps a last time and then end.

So, since V is now 108, p becomes 6. 108 divided by 26 is 1. The 1 goes to the right of the 1, so now we have 11. V becomes 44 since 108-64 is 44.

How?

Now you might be asking yourself how to read these numbers. Well, that’s not so difficult. First, I’ll give a general mathematical explanation which can be fit into one formula:

(4)
\begin{equation} V=vB^P \end{equation}

In human language: the value of the cipher in the number is equal to the value of the cipher on its own multiplied by the base of the number system to the power of the position of the cipher from left to right in the number, starting at 0. Read that a few times and try to understand it.

Thus, the value of a digit in binary doubles every time we move to the left. (see table below)

From this follows that every hexadecimal cipher can be split up into 4 binary digits. In computer language: a nibble. Now take a look at the following table:

Binary Numbers
8 4 2 1 Hexadecimal Value Decimal Value
0 0 0 0 0 0
0 0 0 1 1 1
0 0 1 0 2 2
0 0 1 1 3 3
0 1 0 0 4 4
0 1 0 1 5 5
0 1 1 0 6 6
0 1 1 1 7 7
1 0 0 0 8 8
1 0 0 1 9 9
1 0 1 0 A 10
1 0 1 1 B 11
1 1 0 0 C 12
1 1 0 1 D 13
1 1 1 0 E 14
1 1 1 1 F 15

Another interesting point: look at the value in the column top. Then look at the values. You see what I mean? Yeah, you’re right! The bits switch on and off following their value. The value of the first digit (starting from the right), goes like this: 0,1,0,1,0,1,0,1,0,1,… Second digit: 0,0,1,1,0,0,1,1,0,0,1,1,0,0… Third digit (value=4): 0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,… And so on…

Now, what about greater numbers? Therefore we’ll need an extra digit. (but I think you figured that out by yourself). For the values starting from 16, our table looks like this:

Binary Numbers
16 8 4 2 1 Hexadecimal Value Decimal Value
1 0 0 0 0 10 16
1 0 0 0 1 11 17
1 0 0 1 0 12 18
1 0 0 1 1 13 19
1 0 1 0 0 14 20
1 0 1 0 1 15 21
1 0 1 1 0 16 22
1 0 1 1 1 17 23
1 1 0 0 0 18 24
1 1 0 0 1 19 25
1 1 0 1 0 1A 26
1 1 0 1 1 1B 27
1 1 1 0 0 1C 28
1 1 1 0 1 1D 29
1 1 1 1 0 1E 30
1 1 1 1 1 1F 31
For octals, this is similar, the only difference is that we need only 3 digits to express the values 1->7. Our table looks like this:
Binary Numbers
4 2 1 Octal Value Decimal Value
0 0 0 0 0
0 0 1 1 1
0 1 0 2 2
0 1 1 3 3
1 0 0 4 4
1 0 1 5 5
1 1 0 6 6
1 1 1 7 7

Conversion.

In the latter topic I explained the logic behind the binary, hexadecimal and octal number systems. Now I’ll explain something more practical. If you fully understood the previous thing you can skip this topic.

From decimal to binary

  • Step 1: Check if your number is odd or even.
  • Step 2: If it's even, write 0 (proceeding backwards, adding binary digits to the left of the result).
  • Step 3: Otherwise, if it's odd, write 1 (in the same way).
  • Step 4: Divide your number by 2 (dropping any fraction) and go back to step 1. Repeat until your original number is 0.

An example:
Convert 68 to binary:

  • 68 is even, so we write 0.
  • Dividing 68 by 2, we get 34.
  • 34 is also even, so we write 0 (result so far - 00)
  • Dividing 34 by 2, we get 17.
  • 17 is odd, so we write 1 (result so far - 100 - remember to add it on the left)
  • Dividing 17 by 2, we get 8.5, or just 8.
  • 8 is even, so we write 0 (result so far - 0100)
  • Dividing 8 by 2, we get 4.
  • 4 is even, so we write 0 (result so far - 00100)
  • Dividing 4 by 2, we get 2.
  • 2 is even, so we write 0 (result so far - 000100)
  • Dividing 2 by 2, we get 1.
  • 1 is odd, so we write 1 (result so far - 1000100)
  • Dividing by 2, we get 0.5 or just 0, so we're done.
  • Final result: 1000100

From binary to decimal

  • Write the values in a table as shown before. (or do so mentally)
  • Add the value in the column header to your number, if the digit is turned on (1).
  • Skip it if the value in the column header is turned off (0).
  • Move on to the next digit until you’ve done them all.

An example:
Convert 101100 to decimal:

  • Highest digit value: 32. Current number: 32
  • Skip the "16" digit, its value is 0. Current number: 32
  • Add 8. Current number: 40
  • Add 4. Current number: 44
  • Skip the "2" and "1" digits, because their value is 0.
  • Final answer: 44

From decimal to hexadecimal.

THIS IS ONLY ONE OF THE MANY WAYS!

  • Convert your decimal number to binary
  • Split up in nibbles of 4, starting at the end
  • Look at the first table on this page and write the right number in place of the nibble

(you can add zeroes at the beginning if the number of bits is not divisible by 4, because, just as in decimal, these don’t matter)

An example:
Convert 39 to hexadecimal:

  • First, we convert to binary (see above). Result: 100111
  • Next, we split it up into nibbles: 0010/0111 (Note: I added two zeroes to clarify the fact that these are nibbles)
  • After that, we convert the nibbles separately.
  • Final result: 27

From hexadecimal to decimal

*Check the formula in the first paragraph and use it on the ciphers in your hexadecimal number. (this actually works for any conversion to decimal notation)

An example:
Convert 1AB to decimal:

  • Value of B = 160×11. This gives 11, obviously
  • Value of A = 161×10. This gives 160. Our current result is 171.
  • Value of 1 = 162×1. This gives 256.
  • Final result: 427

From decimal to octal

  • Convert to binary.
  • Split up in parts of 3 digits, starting on the right.
  • Convert each part to an octal value from 0 to 7

Example: Convert 25 to octal

  • First, we convert to binary. Result: 11001
  • Next, we split up: 011/001
  • Conversion to octal: 31

From octal to decimal

Again, apply the formula from above

Example: convert 42 to decimal

  • Value of 2=80×2=2
  • Value of 4=81×4=32
  • Result: 34

Fun Facts

OK, these may not be 100% "fun", but nonetheless are interesting.

  • Do you tend to see numbers beginning with 0x? This is common notation to specify hexadecimal numbers, so you may see something like:
0x000000
0x000002
0x000004

This notation is most commonly used to list computer addresses, which are a whole different story.
  • This is pretty obvious, but you can "spell" words using hexadecimal numbers. For example:
    • CAB = 3243 in decimal notation.

End

Did you understand everything? If you think so, test yourself:

Bin Dec Hex
3A
76
101110
88
1011110
47

Make some exercises yourself, if you want some more.

Lists are one of the most used data types, and they can hold up to 999 elements (the only exception is the TI-83, which can only hold 99 elements). You can also name your own lists, making it the most secure data type available on the TI-83 calculators.

Note: To programmers coming from computers, this is the equivalent of a one-dimensional array.

Before You Start

There are two "types" of lists: predefined and custom. Predefined lists are L₁…L₆, and are accessible by pressing 2nd 1-6 respectively. The casual calculator user is probably using these, so don't use these if you don't have to. Custom lists start with a tiny uppercase ∟, and have a maximum of five characters afterward. You can have lists such as ∟LUNCH, or ∟TODO, or ∟GRR. We will be working with custom lists on this page.

Setting Up Lists

To create a list, all you have to do is this:

:5→dim(∟LIST)

The dim( command creates the list, and the number 5 being put in it tells the list how many elements it has to have in it. But what if you archived it when the program was run last? Then, you need to unarchive it using the UnArchive command:

:UnArchive ∟LIST
:5→dim(∟LIST)

But wait, it isn't that easy! If you try to unarchive something that doesn't exist, you get an ERR:UNDEFINED error! So, we must make sure the list is created first, by using the dim( command. But, if the list does exist and it is archived, we must unarchive it first! What to do, what to do.
You could either wait until the user says whether or not the list exists (not the best choice), or you can use another command available called SetUpEditor.

SetUpEditor

When you use SetUpEditor, you put the name of the list afterwards, like SetUpEditor ∟LIST. If the list doesn't exist, it gets created, if it is archived, it gets unarchived; and if nothing special happened to it, it just does nothing. This one command fixes what would take quite a few lines of code and the possibility of user error. You can then use the dim( command to specify the number of elements in the list. You can use it like so:

:SetUpEditor ∟LIST
:5→dim(∟LIST)

Now your list is set up! Note that for custom lists, the ∟ prefix is not required.

Using a list

Writing

It isn't that hard to use a list. To write something to it, for example, you use this code:

:5→∟LIST(1)

This code writes the number five the the first element of the list. (Computer programmers: the index starts at 1, not 0) To write the first 5 powers of 2 into each element, starting at the first element (with the number 2 inside), you can use this code:

:SetUpEditor ∟LIST
:5→dim(∟LIST)
:For(L,1,5)
:2^L→∟LIST(L)
:End

Inside of the For( loop, we go through each respective element of ∟LIST and store the respective power of 2 into it. The end result of the list is {2 4 8 16 32}.

Reading

Reading from a list is just as easy. To put an element from a list into the variable X, you use this command:

:∟LIST(1)→X

To display the element without storing into the variable, you can do something like:

:Disp ∟LIST(1)

Now, what if the program we made earlier was supposed to show the results? We would modify it like so:

:ClrHome
:SetUpEditor ∟LIST
:5→dim(∟LIST)
:For(L,1,5)
:2^L→∟LIST(L)
:Disp ∟LIST(L)
:End

The first addition is at the very top. ClrHome is just a precautionary measure. The second addition is just before the End, and that is the Disp command, which displays element number L on the screen. Try out the program, and you should see on the home screen:

2
4
8
16
32
Done

Finishing Up

You need to do, at the most, only two things to clean up your list use.

The first is to archive your list using the Archive command, if you want to protect it until next time. Or, if it is only used to hold temporary variables, you can delete it with Delvar.

The second is to SetUpEditor, like so:

:SetUpEditor

This sets up the Edit… command (on the STAT button) so that it allows edit of L₁…L₆. Don't use this, and the student who clicks on Edit… will see ∟GAME appear just as the teacher walks to check on him, and oops.

<< Data Types (intro) Table of Contents Data Types (matrices) >>
The ListPages module does not work recursively.

{$heading}
Besides reading the programming information that the wiki provides, there are several additional TI-Basic tutorials and guides that other people have created that you might find handy. As quality tutorials and guides are hard to come by for TI-Basic and Assembly, some of the tutorials and guides listed here are not that great (they are unfinished or have holes in their content). Still, having the information to read and learn from is better than the converse.
Name Author
UCS TI-Basic Tutorial ?
TI Source - TI-83+ Basic Programming ?
TI-Freakware BASIC Tutorial Daniel Thorneycroft
Kerm Martian's Complete TI-83/+/SE BASIC Tutorials Kerm Martian
BASIC Guru Online Tutorials Ben Ilegbodu
TI 83 BASIC Tutorial Jacob W. Tatay
TI-83 BASIC Tutorial (Portuguese) Sérgio Santos
Basic on TI-82-83+SE Yannick Wrtal
Programming On The TI-82 Andy Gelzleichter
BASIC Tutor Hieu-Trung Le
Programming with the TI-83 Chris Neugebauer
mjs2000 inc. Tutorials ?
Rogue's TI-86 Basic Tutorial ?
HeaneySoft BASIC Tutorial ?
TI-83 Programming Tutorials Lue Her and Andy Becker
TI-BASIC for noobs ?
Resource Description
TI-Basic IRC Channel The #Optimize channel over at United-TI is for TI-Basic code and optimization help. Besides Weregoose, the moderator, there are several other people willing and capable to help beginners (and anyone else) with whatever problems or questions they have. It is a very friendly environment.
TI-Basic Sidebar The TI-Basic Sidebar is a list of the TI-83/84/+/SE commands organized alphabetically for quick reference. Clicking a command link opens up the respective command page on TI-Basic Developer in the main browser window. The sidebar appears as a bookmark in the bookmarks list, and clicking on the bookmark opens up a new frame in the browser.

Routine Summary

Draws an ellipse with specified coordinates.

Inputs

(A,B) - upper left corner, in pixels
(C,D) - lower right corner, in pixels

Outputs

Ellipse inscribed in the rectangle from (A,B) to (C,D)

Variables Used

A,B,C,D for input
∟X and ∟Y store a sin/cos look-up table
Plot1 to store the unit circle
Pic1 to preserve background

Calculator Compatibility

All

Author

Mikhail Lavrov (DarkerLine)

URL: http://mpl.unitedti.org/?p=13

Setup:

:cos(.1πcumSum(binomcdf(20,0→X
:sin(.1πcumSum(binomcdf(20,0→Y
:Plot1(xyLine,∟X,∟Y,(dot)
:PlotsOff

Main code:
:StorePic 1
(:ZoomSto)
:-(B+D)/abs(D-B→Xmin
:(A+C-124)/abs(C-A→Ymin
:2/abs(D-B→ΔX
:2/abs(C-A→ΔY
:PlotsOn 1
:RecallPic 1
:StorePic 1
:PlotsOff
(:ZoomRcl)
:RecallPic 1

To use the routine, add the setup code to the beginning of your program. Then, to draw an ellipse, initialize (A,B) and (C,D) to be opposite corners of an imagined rectangle, in pixel coordinates, and run the main code of the routine. The ellipse will be drawn inside this rectangle (much like the functionality of the circle tool in Paint). Unlike built-in pixel commands, this routine doesn't require the pixels to be on-screen: you can use negative coordinates, and coordinates past the 62nd row and 94th column - of course, if you do, then the off-screen part of the ellipse won't be drawn.

As for speed, the routine is far faster than the Circle( command. If you use Circle( with its undocumented fourth argument, that is a bit faster still - but doesn't allow you as much control over the shape of the ellipse as this routine does.

This routine draws an ellipse given its pixel coordinates in two overall steps:

  1. First, it calculates the window dimensions so that the unit circle (centered at the origin, with radius 1) will be stretched to the required pixel coordinates.
  2. Next, it draws the unit circle.

If the unit circle is stretched to fit in the rectangle from (A,B) to (C,D) then we know the following:

  • The vertical distance from A to C (in pixel rows) should be equivalent to the window distance 2 (from -1 to 1). This allows us to solve for ΔY.
  • The horizontal distance from B to D (in pixel columns) should also be equivalent to the window distance 2. This allows us to solve for ΔX.
  • The pixel most nearly corresponding to the midpoint between (A,B) and (C,D) should be equivalent to the point (0,0), the center of the circle. Given ΔX and ΔY, this allows us to solve for Xmin and Ymin.

The exact math isn't significant, but it gives rise to the formulas you see in the routine. Note that by using the abs( command, we ensure that the order of the two points (A,B) and (C,D) isn't important: you can switch A and C, or B and D, and still get the same circle.

The code for actually drawing the circle uses a look-up table for sine and cosine (which defines 20 points spaced around the circle). The table is calculated in the setup code, and then an xyLine plot is initialized, which will connect these 20 points when graphed. Now, to draw the unit circle, all that needs to be done is to enable the plot, using the PlotsOn command. This actually draws a 20-gon, rather than a circle, but the difference is imperceptible even on large circles.

The rest of the code is necessary to preserve the graph screen as the window changes and Plot1 is enabled and disabled (which causes the screen to be cleared), using StorePic and RecallPic. Optionally, you can also preserve the window dimensions, using ZoomSto and ZoomRcl — this is useful if your program mixes pixel and point commands.

The routine uses three fairly large variables to do its work: ∟X, ∟Y, and Pic1. ∟X and ∟Y need to be preserved from the setup code to whenever the routine is called; Pic1 is only used temporarily. It's a good idea to clean up all three by deleting them at the end of the program.

{$strategyBegin}
Name Size Libraries? Compatibility Author
Bang Bang 3,670 No TI-83/84/+/SE Sean Weeks
Checkers 13,249 No TI-83/84/+/SE nitacku
Chess Pro 6,869 No TI-83/84/+/SE Francis Huang
Connect 4 4,000 No TI-83/84/+/SE SiCoDe
Dots 1,311 No TI-83/84/+/SE Travis Fischer
Lights Out 3,400 No TI-83/84/+/SE Scott Davis
Minesweeper 3,339 Yes TI-83+/84+/SE Fred Sparks
World Domination 10,000 No TI-83/84/+/SE Kerm Martian
World Empire 5,714 No TI-83/84/+/SE Arthur O'Dwyer
Xmove15 1,574 No TI-83/84/+/SE XprO

{$strategyEnd}

{$rpgBegin}
Name Size Libraries? Compatibility Author
Castle Adventure 6,700 No TI-83/84/+/SE Arthur O'Dwyer
Metroid Pi 17,000 No TI-83/84/+/SE Harrierfalcon

{$rpgEnd}

{$sportsBegin}
Name Size Libraries? Compatibility Author
Bowling 16,384 Yes TI-83+/84+/SE Nitacku
Slam Session 4,200 No TI-83/84/+/SE Jason Russell

{$sportsEnd}

{$puzzleBegin}
Name Size Libraries? Compatibility Author
Brick Block 7,500 No TI-83/84/+/SE SiCoDe
Donut Quest 10,276 No TI-83/84/+/SE Mikhail Lavrov
DStar 4,800 No TI-83/84/+/SE Scott Davis
Lode Runner 3,000 No TI-83/84/+/SE SiCoDe
Sudoku 4,051 No TI-83/84/+/SE Harrierfalcon
Tower Of Hanoi 2,783 No TI-83/84/+/SE Martin Johansson

{$puzzleEnd}

{$arcadeBegin}
Name Size Libraries? Compatibility Author
Blizz 1,863 No TI-83/84/+/SE Martin Johansson
Bomberman 4,969 No TI-83/84/+/SE Travis Fischer
Contra 10,000 No TI-83/84/+/SE Bryan Thomas
Dino Eggs 2,357 No TI-83/84/+/SE Alex Snyder
Frogger 1,232 No TI-83/84/+/SE SiCoDe
Nibbles Arcade 7,261 No TI-83/84/+/SE SiCoDe
Pipes 5,276 No TI-83/84/+/SE Sean Sartell
Snake Escape 1,120 No TI-83/84/+/SE Alex Snyder
Tetris 2,877 No TI-83/84/+/SE Nitacku
War 2,000 No TI-83/84/+/SE SiCoDe
Xsnake 1,468 No TI-83/84/+/SE XprO

{$arcadeEnd}

{$casinoBegin}
Name Size Libraries? Compatibility Author
Commerce 5,300 No TI-83/84/+/SE Arthur O'Dwyer
Solitaire 3,993 No TI-83/84/+/SE Nitacku
Yahtzee 6,329 No TI-83/84/+/SE Brad Wentz

{$casinoEnd}

{$miscellaneousBegin}
Name Size Libraries? Compatibility Author
Civilization Simulator 13,000 No TI-83/84/+/SE Kerm Martian
Office XE 21,076 No TI-83/84/+/SE Brad Wentz

{$miscellaneousEnd}

One of the great things about working with TI Basic is that people are always developing new routines. This page is where you can display code for things that you think could be better than currently accepted routines.

GetKey Routines

This alternate routine is a size optimization of the usual movement routine used to move a character around the screen (9 bytes less than the regular routine). It is a replacement for the currently accepted movement routine. It was discovered by Darkstone Knight and Burr and implemented by Basickevin.

:4→A
:8→B
:While 1
:getKey→K
:1
:If K
:" //one space//
:Output(A,B,Ans
:min(8,max(1,A+sum(Δlist(K={25,34→A
:min(16,max(1,B+sum(Δlist(K={24,26→B
:End

This is Basickevin's speed optimization of the same routine. It's about 15% faster, 25 bytes larger, and the variables are all under the finanace window.

:4→PMT
:1→FV
:While 1
:getKey→PV
:If PV
:Output(PMT,FV," //one space//
:min(8,max(1,PMT+sum(Δlist(PV={25,34→PMT
:min(16,max(1,FV+sum(Δlist(PV={24,26→FV
:Output(PMT,FV,1
:End

References

Routine Summary

A simple instant messaging program.

Inputs

Str3

Outputs

None

Variables Used

A, Str1, Str2, Str3

Calculator Compatibility

TI-83/84/+/SE

Author

James Kanjo

Download

im.zip

:"→Str1
:"→Str2
:GetCalc(A
:e(A=π)+π(A≠π→A
:Lbl M
:ClrHome
:Menu("IM","READ",R,"SEND",S,"QUIT",Q
:Lbl S
:Input "SEND MESSAGE:   ",Str3
:If A=π:Str3→Str1
:If A=e:Str3→Str2
:Goto M
:Lbl R
:If A=e:Then
:GetCalc(Str1
:Str1
:Else
:GetCalc(Str2
:Str2
:End
:Output(1,1,Ans
:Pause :Goto M
:Lbl Q

An "Instant Messaging" program, is a program that allows you to have an "instant" conversation with another person via a computer of some sort. With this program, you must connect two calculators via the calculator-calculator cable (it's about 22 centimetres long) before initiating the program on both calculators. Using this program means that you can be massive 22 centimetres away from a friend, and STILL be able to have conversations with them.

Obviously this is a silly program, but its real purpose is to demonstrate the calculator's capacity to communicate with other calculators — and it's a great 'learning program'.

Firstly, the program resets the Str1 and Str2 variables, which are used to later display "received messages", and executes the getcalc( command to retrieve variable A from the connected calculator. Then the program does something tricky; it checks to see if the variable A is equal to π (pi). If so, then it sets variable A to e. If A does not equal π, then π is stored to A. This is a complicated process which gives each calculator it's own identity — a vital part of cross-calculator programs.

The menu then appears giving the user options to "receive" a message, "send" a message and to "quit". When the user tries to send a message, the program retrieves the user's input and temporarily stores it into Str3. The program then stores Str3 to variables Str1 or Str2, depending on the value of A. When the user goes to retrieve a message, depending on the value of A, it selectively retrieves Str1 or Str2 from the other calculator, which is the message that the other user has "sent".

Of course, this isn't true instant messaging, but is at the least a simulation of it. Because the GetCalc( command retrieves data from another calculator, the other calculator needs to be idle to be able to send it. This program works because both calculators are always idle — in the menu, when typing a message and when reading a message. This routine uses Str1, Str2 and Str3, which you should clean up at the end of your program.

While the contribute and conventions pages answer the general questions about how to create and edit pages, this page answers the specific questions about editing the homepages and any specialty pages (such as the command pages). If you have any questions that aren't mentioned, please leave a post in the forum or make a comment at the bottom of the page.

Uploading files

There is now a tutorial to upload files on the site.

Recent News

When you add some new content to the wiki, it is always recommended that you let the community know what you have done — especially if you made some significant edits.

Each news item is stored on it's own page in the news category, including appropriate tags about the page; _news _83portal _68kportal _both-portals. These tags help us to automatically organise the news into categories. You can add news through the add news page.

The news can be viewed through the 83 news, 68k news and all news pages. The portal home pages also automatically retrieve the 5 most recent news elements relative to their portal of the site.

New Members

We love to encourage people to become members and contribute to improve the quality of the site. This is why we decided to compile a list of every member in the chronological order that they joined. From this page, we are able to show our appreciation with a warm welcome on the home pages to the newest members of the community.

Unfortunately, this is a manual process — a member needs to regularly check the automatic list on the members page for any new members. If you notice that a new member has joined, please take it upon yourself to update the list.

Home Infobox

On the home pages of the 83 and 68k portals, there is an infobox on the right-hand side of the page. This infobox provides some short, but useful information about some of the different sections of the site: how to get involved, what's happening in the forums, some interesting TI-Basic tidbits, the "top 10" rated programs, the featured article and the featured command.

These things are not actually editable on the home pages themselves, but instead are automatically retrieved from other pages on the site — which is quite useful because it saves us from having to create duplicate copies of the same information. To manipulate these pages, just visit their appropriate links, and follow the instructions on those pages:

TI-83 Infobox: TI-68k Infobox:
83 Did You Know for Did you know… items.
83 Featured Command for the featured command.
83 Featured Article for the featured article.
68k Did You Know for Did you know… items.
68k Featured Command for the featured command.
68k Featured Article for the featured article.

Include Pages

TI-Basic Developer utilizes the convenience of "include templates" throughout the site (a list of which can be found on the inc:overview page). These special pages are included as part of another page, and are used as templates for similar sections of code repeated amongst many pages (and hence, their name).

For example, each command page has an infobox on the right-hand side giving specific details about the command. To get the template, we type in [[include inc:command, and then type in the values. This is much simpler and easier to use than typing out the whole infobox for each command, not to mention easier to understand and manage.

For specific details on how to use all of the include templates, see the inc:overview page.

Privileges Required

There are some pages on the site which can't be edited by ordinary members alone. This is because we believe that some pages just don't need editing, and don't need to risk being tampered with. In such cases that you believe one of these pages can be improved, then you have one of two options:

  1. Start a discussion page in the forums; or
  2. Send a private message to one of the administrators or moderators.

Both options are effective, and so the decision is a matter of preference. If you want the community's opinion on the matter, post it in the forums. If you prefer to keep your conversations private, just send a private message: click on the avatar of the person, and click on the link saying "write private message".

Program Archives

When people upload programs to the archives, it is up to us to do the hard work and integrate their program pages with the rest of the site. If you see any programs pending in the _to-do page, there are a few things you need to do:

  1. Edit the page source — click on the "edit" button at the bottom of the page, then:
    • Paste the image URL (if any) in the |picture= section
    • Paste the program URL in the |downloadUrl= section
    • Copy the program file name in the |downloadName= section (for example, type in "Game.zip")
  2. Click on the "save" button;
  3. Remove the "_pending" tag — click on the "tag" button at the bottom of the page, and delete ONLY the "_pending" tag.

You may want to see the full details of the tablet include.

The featured commands are articles that represent the best TI-Basic Developer has to offer. A featured command meets all of the following requirements:

  • Well-Written — It is easy to read, flows smoothly, and does not have any spelling or grammatical errors.
  • Complete — It includes everything about the command, including theory, code examples, and screenshots, when appropriate.
  • References — If applicable, it lists the sources that were used in putting together the command.

To nominate a command for being featured, add it to the list below.

Featured Command Candidates:

  • None so far… feel free to nominate one!

Featured Commands:

The ListPages module does not work recursively.

{$part1begin}

To add a command, move the current featured command from {$part2} to {$part3}, and add a new featured command to {$part2}. See the featured commands page to view the data on this page in a cosmetic format.

{$part1end}
{$part2begin}

The Menu( command displays a generic menu on the home screen, with up to seven options for the user to select from.

If you need more than seven options, you can create another menu and then link to that menu.
(more...)

{$part2end}
{$part3begin}

None yet…

{$part3end}

{$part1-start}

To add any new members on a new date, move the first date from {$part3} to {$part2}, and add a new date to {$part3}. The date format is day/month.

See the members page to view the data on this page in a cosmetic format.

{$part1-end}

{$part2-start}

2006

Sep 01 TI-Basic Developer wiki is started by burrburr using the content from his TI-Basic Developer guide as the foundation for the wiki.
Sep 02 alexruddalexrudd
Sep 02 Fallen GhostFallen Ghost
Sep 11 DarkerLineDarkerLine
Sep 24 Sage OratorSage Orator
Sep 24 calc84maniaccalc84maniac
Sep 25 HarqHarq
Oct 01 super_spelersuper_speler
Oct 22 adcurtinadcurtin
Oct 25 halg19halg19
Oct 25 airmintairmint
Oct 25 MgNateMgNate
Nov 04 elfprinceelfprince
Nov 06 lubyluby
Dec 08 Allen LiuAllen Liu

2007

Jan 17 HarrierfalconHarrierfalcon
Jan 18 WeregooseWeregoose
Feb 11 WikiGuruWikiGuru
Mar 21 blm22blm22
Mar 31 Jonn89Jonn89
Apr 11 XphoenixXphoenix
Apr 14 thornahawkthornahawk
Apr 16 xxfffreakxxxxfffreakxx
Apr 16 Baorder54Baorder54
May 15 ebscerebscer
Jun 11 GraeliGraeli
Aug 20 geemangeeman
Sep 04 pzhukkepzhukke
Sep 04 valentinevalentine
Oct 04 simplethinkersimplethinker
Nov 04 angel14995angel14995
Nov 13 JoostinOnlineJoostinOnline
Dec 12 AnkillitoAnkillito
Dec 18 Ein_HaldenlebenEin_Haldenleben
Dec 24 OninionOninion

2008

Jan 16 kalan_vodkalan_vod
Jan 18 brenns10 does not match any existing user name
Jan 21 whatifitsnotwhatifitsnot
Jan 26 SocksSocks
Jan 27 AcroAcro
Feb 03 Zaphod BeeblebroxZaphod Beeblebrox
Feb 10 CesiumCesium
Feb 12 ryborybo
Feb 23 RandomProductionsRandomProductions
Feb 28 prototypicalXprototypicalX
Mar 20 TroyLSandersTroyLSanders
Mar 23 Recipito does not match any existing user name
Mar 25 James KanjoJames Kanjo
Mar 25 BluedragonBluedragon
Mar 28 pokedotpokedot
Apr 10 AJLitzau13AJLitzau13
Apr 28 RevenantphoenixRevenantphoenix
May 04 krazynesskrazyness
May 04 lupus6x9lupus6x9
May 07 patriotsfanpatriotsfan
May 10 Nick53Nick53
May 26 basickevinbasickevin
May 31 MosquitoMosquito
Jun 06 Jonathan KingJonathan King
Jun 10 Edward HEdward H
Jun 10 NorinionNorinion
Jun 10 FlameviperFlameviper
Jun 10 piano_manpiano_man
Jun 11 MobiusIntellectusMobiusIntellectus
Jun 11 HedonismBotHedonismBot
Jun 11 zapperpostzapperpost
Jun 12 --dome91----dome91--
Jun 12 builderboybuilderboy
Jun 12 graphmastur does not match any existing user name
Jun 12 ZagorNBKZagorNBK
Jun 13 ArjenArjen
Jun 13 WordsHereWordsHere
Jun 14 darkstone knightdarkstone knight
Jun 18 Mapar007Mapar007
Jun 19 TowelyTowely
Jun 21 MallkuMallku
Jun 22 olin3434olin3434
Jun 25 froggy222froggy222
Jun 26 zerompzeromp
Jun 28 7thAce7thAce
Jul 01 perilquestperilquest
Jul 02 my_namemy_name
Jul 12 fractalpfractalp
Jul 18 architeuthiskidarchiteuthiskid
Aug 16 larry4624larry4624
Aug 16 papwalkerpapwalker
Aug 21 TI-86erTI-86er
Aug 25 GamuelGamuel
Aug 28 someon3426someon3426
Sep 07 noahbaby94noahbaby94
Sep 09 ePIiePIi
Sep 17 Timothy FosterTimothy Foster
Sep 17 Will WestWill West
Sep 23 snacks tastysnacks tasty
Sep 24 The RenegadeThe Renegade
Oct 02 programmarprogrammar
Oct 03 gumbeegumbee
Oct 04 nintendoriot101nintendoriot101
Oct 07 paintballnoobpaintballnoob
Oct 24 bxsciencer does not match any existing user name
Oct 25 LeperboyLeperboy
Oct 26 skuller972skuller972

{$part2-end}
{$part3-start}

Oct 27 ibly31ibly31
Nov 01 DrCoyoteDrCoyote
Nov 09 MasterDonut09 does not match any existing user name
Nov 12 RecipeRecipe
Dec 14 TI123outermeTI123outerme

{$part3-end}

Random Numbers provide the essence of most games. They keep that element of chance alive. You cannot substitute for random numbers without someone who plays the game over and over again to figure out a pattern. Below we will start a discussion of random numbers.

The Commands

rand

The rand command generates a random number between 0 and 1. It will display a decimal number longer than you can care for. It requires no arguments.
BUT WAIT! There is a secret function to rand. First we must tell you something: the calculator doesn't produce random numbers. It's true. Calculators use pseudorandom number generators. It uses a complex formula to create the "random" numbers, mainly by a processing cycle. The secret to the random numbers is something called the seed. The seed is a number that is used to determine these random numbers. It is the starting number used, and an algorithm is used to generate pseudorandom numbers. One example method is the middle-square method, which starts with the seed, squares the number, and takes the half of that number, and repeats the cycle to generate numbers. More information about random vs. pseudorandom numbers can be found in this Khan Academy video: https://www.youtube.com/watch?t=59&v=GtOt7EBNEwQ

The secret function to rand, is that you can set the seed using:

:x→rand

where x equals the number. Set the seed to 1 on two different calculators and they put out the same sequence of numbers.

Here's a trick. To set the seed to a random number, use this code:

:rand→X
:X→rand

rand can also be multiplied in order to get larger numbers. Just put a coefficient before rand. Also, you can generate a list of random numbers by doing this:

:rand(x)

This will generate a random list with x number of elements.

randBin(

This command randBin(numtrials,prob) requires two arguments. numbtrials specifies the number of trials, and prob requires a number between 0 and 1.
The manual's definition is this:
Generates and displays a random real number from a specified Binomial distribution.

randInt(

Ah, yes, this one. It's the most common random number command. It requires two arguments, both very simple.
The command is randInt(lower, upper). Lower specifies the minimum number possible. Upper specifies the maximum possible. For example, randInt(1,10) will generate a whole number between 1 and 10.
Here is a simple program that uses randInt(

:ClrHome
:Disp "Think of your"
:Disp "question and"
:Disp "press enter."
:Pause
:randInt(0,2)→X
:"Maybe"
:If X=1
:"Yes"
:If not(X)
:"No"
:Disp Ans

In this program, the user thinks of a question that he or she would ask a magic eight ball. It calculates a random integer between 0 and 2 (0, 1, or 2). It makes "Maybe" the default answer. The program then tests the random number under the conditions to make the string, "Maybe", change to "Yes", "No", or remain the same.

randM(

This may be not as well-known as the others. This command will generate a random matrix. The command syntax is randM(rows,columns). Rows stands for the number of rows in the matrix, columns for the number of columns. The numbers in the matrix are the random part.

randNorm(

This command will generate a number, with given randNorm(µ,σ), within the range µ±3σ. The command uses a normal distribution based on the 68-95-99.7 empirical rule. When the third argument is given, it will generate a list of that many elements.

Putting it Together

Let's make a program that will use the random commands. The program will be a game where it is you against the computer. You take turns where one player thinks of a number between 1 and 10, and the other player must guess as close as possible. The AI will use random numbers as his guess.

:rand→X
:X→rand
:ClrHome
:SetUpEditior L₁
:{30,30}→L₁
:Delvar A
:Repeat L₁(A)<0
:A(A≠2)+1→A

Okay, first we reset the seed. Then, we set up the game by storing each player's health into a list and deleting A, the turn. The loop starts and is set to end when a player's health reaches below zero. The next thing that happens is that the player number turn switches between 1 and 2, with human being 2 and AI being 1.
:If A=2
:Then
:Repeat N>0 and N≤10
:Input "Your Number?_",N
:int(N)→N
:End
:randBin(10,N/10)
:End

This is what happens when it is your turn. You must input a number where the calculator makes sure your number isn't less than 1 or greater than 10. It also ensures an integer number. The calculator uses a formulated guess which gives it a higher probability of guessing right (I know… cheap).
:If A=1
:Then
:Input "Guess?_",N
:abs(int(N))→N
:randInt(1,10)
:End

This is what happens when it is the calculator's turn. The calculator first randomly chooses a number, and then you are asked to give a guess. The calculator will not check for boundaries, but it will check for decimals.
:ClrHome
:L₁(A)-abs(N-Ans)→L₁(A)
:End
:ClrHome
:"You"+sub("Win!Lose",3(L₁(1)<0)+1,4)

This is the final part of the code where it takes the difference of the guesses and subtracts that from the turn player's opponent. When the game ends, it displays a message at the end.
:rand→X
:X→rand
:ClrHome
:SetUpEditior L₁
:{30,30}→L₁
:Delvar A
:Repeat L₁(A)<0
:A(A≠2)+1→A
:If A=2
:Then
:Repeat N>0 and N≤10
:Input "Your Number?_",N
:int(N)→N
:End
:randBin(10,N/10)
:End
:If A=1
:Then
:Input "Guess?_",N
:abs(int(N))→N
:randInt(1,10)
:End
:ClrHome
:L₁(A)-abs(N-Ans)→L₁(A)
:End
:ClrHome
:"You"+sub("Win!Lose",3(L₁(1)<0)+1,4)

That sums up random numbers, and the last section of this chapter. We hope you learned a lot.
<< Data Types (strings) Table of Contents Summary >>

An algorithm refers to your method of solving a problem. Algorithmic optimization, then, relies on choosing the best method to solve a particular problem. Although we could choose a complex problem to illustrate algorithmic optimization, a simpler problem is equally sufficient in demonstrating the process that you go through.

For our example problem, imagine that you want to reverse the characters in a string: if the string is "HELLO", you want it to be "OLLEH". This obviously is a routine that would only really be useful if you are writing a text editor, and are providing different ways for the user to manipulate the text (search, replace, insert, copy, etc.).

Knowing what the routine needs to do, the straightforward approach to writing it is to use another string to store the reversed string, and then concatenating the respective substring to the end of the string while looping over the original string backwards using a For( loop. Here is what the code would look like:

:" "
:For(I,length(Str1),1,-1
:Ans+sub(Str1,I,1
:End
:sub(Ans,2,length(Ans)-1→Str1

As you can see, we are using the Ans variable to hold our temporary string of reversed characters. You should also note that we initialize it to one space before entering the For( loop. This is because TI-Basic does not allow empty strings — it will actually return a ERR:DOMAIN if you try to concatenate or manipulate the string.

Although this approach is efficient, there are still other ways to write the routine. One possibility is using recursion — the program calling itself. This is basically replicating what the For( loop was doing in the previous routine, except this time we don't have an additional variable to keep track of the string position. Instead we are using the actual length of the string itself, and then subtracting the length of the temporary string from that.

In order for this to work, however, we need to add an additional character to the end of our string. This is because our temporary string is initialized to a space, so we need to offset this character to get the complete reversed string. If we don't add the extra character, our reversed string will be missing the first character from the original string — we would get "LLEH" instead of "OLLEH".

The actual code for the routine is:

:Ans+sub(Str1,length(Str1)-length(Ans),1
:If length(Ans)<length(Str1
:prgmREVERSTR
:sub(Ans,2,length(Ans)-1→Str1

Note that in order to run the routine, you need to initialize Ans on the home screen to a string with one character: a space is the character we like to use, but it can be a question mark, a letter, a number, or whatever you want. Also note that the program name must be the actual name of the program on your calculator; we just called our program REVERSTR because we like names that are descriptive.

When you try out this routine, you should notice that it works just as effectively as the first routine for short or medium length strings. However, if you try using a long string, the routine might not actually complete, but instead the calculator will run out of memory — giving you a ERR:MEMORY error.

Each time a program call is made, the calculator puts it on a stack and it takes sixteen bytes to keep track of each program call. Because this stack is placed in RAM, whether you are able to completely reverse the string or not depends on how much free RAM you have on your calculator.

The other problem with using this routine is that it has to be its own stand-alone program. This is because the code has to go at the beginning of the program, in order for the recursion to work correctly. Of course, a four line program isn't necessarily bad, but it can be a nuisance having to remember an additional program to use your program.

Using recursion to reverse a string is obviously not going to work for us when you factor in the memory for the program calls and the additional program, so that means we should stick to using a For( loop. Now we need to think about how else we could go about reversing a string.

How about instead of looping over the string backwards and appending the respective substring to the end of the string, we loop forwards and append the substring to the beginning of the string? Does that sound like it would work any better? Well, let's try it.

We are still going to use the temporary string stored in Ans like we did with the other two routines, except this time the original string is stored to Ans instead of just a dummy character. We then loop through each character starting from the beginning to the end, adding it to the beginning of the string as we build up the reversed string.

Here is what the code would look like:

:Str1
:For(I,1,length(Ans)-1
:sub(Ans,2I,1)+Ans
:End
:sub(Ans,1,I→Str1

Since adding to the beginning of the string alters the index, we must take that into account — this is where the 2I in the formula comes from. It adds the 2nd character the first time, the 4th character (which was originally the 3rd) next, the 6th character (originally the 4th) after that, and so on.

Comparing the size of the last routine to the size of the first two routines, the code is now smaller, and so coming up with a better algorithm has resulted in a better program. Of course, this required some creative thinking on our part, but it was well worth the effort.

[[include inc:routine
|picture=@@
|summary=@@
|input=@@
|output=@@
|variable=@@
|compatibility=@@
|author=@@
|authors=@@
|url=@@
|download=@@
]]

|picture=

If the image is embedded on the same page, then only the full name of the image is to be written here. Otherwise, simply paste the full URL of the image.

|summary=

Just type in a brief description of the routine

|input=

Enter all inputs required for the routine to work, and include a brief description of what they are

|output=

Enter all outputs the routine generates, and include a brief description of what they are

|variable=

Just give a brief description of all variables the routine uses

|compatibility=

Enter the calculators compatible with a syntax similar to the example used for all calculators: TI-83/84/+/SE

|author=

Enter the author of the routine, if only one person created it

|authors=

Enter a list of authors of the routine, if more than one person created it

|url=

Enter a URL to any relevant or related websites, followed by a space, and what you want to display. For example: |url=http://www.unitedti.org Routine's Derivative

|download=

Enter the URL to a downloadable version of the routine, followed by a space, and what you want to display. For example: |url=http://tibasicdev.wikidot.com/routine.zip routine.zip

[[include inc:program
|picture=@@
|summary=@@
|size=@@
|libraries=@@
|compatibility=@@
|author=@@
|download=@@
]]

|picture=

If the image is embedded on the same page, then only the full name of the image is to be written here. Otherwise, simply paste the full URL of the image.

|summary=

Just type in a brief description of the program

|size=

Just type in a brief description of the program size

|libraries=

Just type in a brief description of what libraries are required to run the program

|compatibility=

Enter the calculators compatible with a syntax similar to the example used for all calculators: TI-83/84/+/SE

|author=

Enter the name of the author of the program

|download=

Type in the URL to the program in accordance with the wiki syntax, and any other details if required

A | B | D | E | I | L | M | N | O | R | S | T | U | V | W | Z

In the Error Conditions section on a command page, descriptions will be given of the errors that can result when using a command. These do not include errors that can occur with virtually any command, such as ERR:ARGUMENT or ERR:SYNTAX. However, if one of these errors is triggered in an unusual way, it will be listed.

Be aware that certain errors don't occur when graphing or using one of the commands DrawF, DrawInv, Tangent(, or Shade(. Instead, the graph point is skipped and treated as an undefined value. Tangent( is a minor exception, actually: if there's an error at the tangent point, it will be treated normally. The errors that are ignored in graphs are:

There are are also several error messages that don't actually occur (as far as anyone knows) from normal use of the calculator — however, the messages are stored in the OS along with the normal messages. It's conceivable that an assembly program, especially an official TI application, would use these error messages for its own purposes. These messages are ERR:SOLVER, ERR:SCALE, ERR:NO MODE, ERR:LENGTH, and ERR:APPLICATION.

A

ARCHIVED

  • You have attempted to use, edit, or delete an archived variable. For example, dim(L1) is an error if L1 is archived.
  • Use UnArchive variable name to unarchive the variable before using it. For lists, SetUpEditor is recommended instead since it does the same thing, but works on the TI-83 (which has no archive) as well, and does not crash when the list is undefined.
  • There is no way to archive or unarchive programs using pure Basic, although several assembly utilities are available for doing so.
  • When you attempt to edit a archived Matrix,List,Variable, or program, the option 2:GOTO doesn't show up.
  • Use Unarchive or the memory manager to unarchive a variable,matrix,list, program, etc.

ARCHIVE FULL

  • You have attempted to archive a variable and there is not enough space in archive to receive it.
  • Sometimes, if the calculator displays a message from memory management saying "Garbage Collect?", choosing the option No gives this error.

ARGUMENT

  • A function or instruction does not have the correct number of arguments. See the appropriate command page.
  • A function or instruction that can have any number of arguments has 256 or more.
  • In general, if a function has more than one non-SYNTAX error in it, this is the error that will be generated first (if it applies, of course).
  • Generally, on graphing calculators and such, most functions ex: randInt( require that you use commas to make a list.

B

BAD ADDRESS

  • You have attempted to send or receive an application and an error (e.g., electrical interference) has occurred in the transmission.

BAD GUESS

  • With the solve( function, the equation solver, or an operation from the CALC menu, your guess wasn't within the lower and upper bound, or else the function is undefined at that point. Change the guess.

BOUND

  • In a CALC operation or with Select(, you defined Left Bound > Right Bound.
  • In fMin(, fMax(, solve(, or the equation solver, the lower bound must be less than the upper bound.

BREAK

  • You pressed the [ON] key to break execution of a program, to halt a DRAW instruction, or to stop evaluation of an expression.

D

DATA TYPE

  • You entered a value or variable that is the wrong data type.
  • For a function (including implied multiplication) or an instruction, you entered an argument that is an invalid data type, such as a complex number where a real number is required.
  • In an editor, you entered a type that is not allowed, such as a matrix entered as an element in the stat list editor.
  • You attempted to store an incorrect data type, such as a matrix to a list.
  • You attempted to divide matrices, which should be done by matrix inversion and multiplication instead.
  • This error is not returned when graphing (see the note at the top of the page).

DATE

  • Only on the TI-84+ or TI-84+ SE, this error occurs when an invalid date is entered.
  • Below the error menu, an explanation of what's wrong is given: e.g., "Invalid day for month selected."

DIM MISMATCH

  • You attempted to perform an operation that references more than one list or matrix, but the dimensions do not match.
  • In most cases, the dimensions are required to be equal, with the following exceptions:
    • When multiplying two matrices, the number of columns of the first must match the number of rows of the second.
    • When using augment( to combine two matrices, only the number of rows must match.
    • With the List►matr( command, the lists don't have to match sizes - shorter lists will be padded with zeroes.

DIVIDE BY 0

  • You attempted to divide by zero.
  • You attempted a linear regression on data that fit a vertical line.
  • This error is not returned when graphing (see the note at the top of the page).

DOMAIN

  • You specified an argument to a function or instruction outside the valid range. This error is not returned during graphing. The TI-83+ allows for undefined values on a graph.
  • You attempted a logarithmic or power regression with a negative X or an exponential or power regression with a negative Y.
  • You attempted to compute ΣPrn( or ΣInt( with pmt2 < pmt1.
  • You've assigned a value to n (the sequential graph variable), nMin or nMax that isn't an integer, or that is less than 0.
  • This error is not returned when graphing (see the note at the top of the page).

DUPLICATE

  • You attempted to create a duplicate group name.
  • You attempted to create a duplicate program using AsmComp(.

Duplicate Name

  • A variable you attempted to transmit cannot be transmitted because a variable with that name already exists in the receiving unit.
  • Also appears when you unpack a group and a variable in the group is already defined. In both cases, it will give you several options for correcting the error, including Omit, Rename, and Overwrite.

E

EXPIRED

  • You have attempted to run a Flash application with a limited trial period which has expired.

Error in Xmit

  • The TI-83+ was unable to transmit an item. Check to see that the cable is firmly connected to both units and that the receiving unit is in receive mode.
  • You pressed [ON] to break during transmission.
  • You attempted to perform a backup from a TI-82 to a TI-83+.
  • You attempted to transfer data (other than L1 through L6) from a TI-83+ to a TI-82.
  • You attempted to transfer L1 through L6 from a TI-83+ to a TI-82 without using 5:Lists to TI-82 on the LINK SEND menu.
  • You attempted to use SendOS with no other calculator connected.
  • When this error occurs, the option 2:Goto doesn't show up, but will redirect you to the LINK screen instead of the main screen.

I

ID NOT FOUND

  • This error occurs when the SendID command is executed, but the proper calculator ID cannot be found.
  • When this error occurs, the option 2:Goto does not show up.

ILLEGAL NEST

  • You attempted to use an invalid function in an argument to a function.
  • This happens when using seq( in the expression for seq(, fnInt( within the first argument of fnInt(, expr( inside the string argument of expr(, or Σ( within the argument for Σ(.

INCREMENT

  • The increment in seq( is 0 or has the wrong sign.
  • The increment in a For( loop is 0.
  • This error is not returned when graphing (see the note at the top of the page).

INVALID

  • You attempted to reference a variable or use a function where it is not valid. For example, Yn cannot reference Y, Xmin, ΔX, or TblStart.
  • You attempted to reference a variable or function that was transferred from the TI-82 and is not valid for the TI-83+. For example, you may have transferred UnN1 to the TI-83+ from the TI-82 and then tried to reference it.
  • In Seq mode, you attempted to graph a phase plot (uvAxes, uwAxes, or vwAxes) without defining both equations of the phase plot.
  • In Seq mode, you attempted to graph a recursive sequence without having input the correct number of initial conditions.
  • In Seq mode, you attempted to reference terms other than (n-1) or (n-2).
  • You attempted to designate a graph style that is invalid within the current graph mode.
  • You attempted to use Select( without having selected (turned on) at least one xyLine or scatter plot.
  • You attempted to use certain functions (e.g. If, Then, Else) outside a program.

INVALID DIM

  • You tried to access an element past the end of a list or matrix (there is an exception: it's allowed to store to the element one past the end of a list, adding the element).
  • You specified dimensions for an argument that are not appropriate for the operation.
  • You specified a list dimension as something other than an integer between 1 and 999.
  • You specified a matrix dimension as something other than an integer between 1 and 99.
  • You attempted to invert a matrix that is not square.

ITERATIONS

  • The solve( function or the equation solver has exceeded the maximum number of permitted iterations. Examine a graph of the function. If the equation has a solution, change the bounds, or the initial guess, or both.
  • irr( has exceeded the maximum number of permitted iterations.
  • When computing I%, the maximum number of iterations was exceeded.

L

LABEL

  • The label in the Goto instruction is not defined with a Lbl instruction in the program.
  • When this error occurs, the option 2:Goto doesn't show up.

Link

  • Something in the flash application was invalid while running.
  • When this error occurs, the option 2:Goto doesn't show up.

M

MEMORY

  • Memory is insufficient to perform the instruction or function. You must delete items from memory before executing the instruction or function.
  • You might also want to try archiving some variables,matrixes,lists,etc if you have nothing in RAM that you don't need.
  • Recursive problems return this error; for example, graphing the equation Y1=Y1. (but Y1=X, Y2=Y1, for example, will NOT cause an error.)
  • Branching out of an If:Then, For(, While, or Repeat loop with a Goto will waste memory until the program finishes running, because the End statement that terminates the loop is never reached. Unless a program is very large, this is one of the likeliest causes of ERR:MEMORY. Refer to memory-leaks.

MemoryFull

  • You are unable to transmit an item because the receiving unit’s available memory is insufficient. You may skip the item or exit receive mode.
  • During a memory backup, the receiving unit’s available memory is insufficient to receive all items in the sending unit’s memory. A message indicates the number of bytes the sending unit must delete to do the memory backup. Delete items and try again.
  • You may also try to archive some variables to free up some memory that you do not plan to transmit.

MODE

  • You attempted to store to a window variable in another graphing mode or to perform an instruction while in the wrong mode; for example, DrawInv in a graphing mode other than Func.

N

NO SIGN CHNG

  • The solve( function or the equation solver did not detect a sign change.
  • You attempted to compute I% when FV, (N*PMT), and PV all share the same sign.
  • You attempted to compute irr( when CFList and CFO share the same sign.

NONREAL ANS

  • In Real mode, the result of a calculation yielded a complex result.
  • This error is not returned when graphing (see the note at the top of the page).
  • This error can appear if you use a negative number for some operations, such as ln

O

OVERFLOW

  • You attempted to enter, or you have calculated, a number that is beyond the range of the calculator (-1E100 to 1E100, non-inclusive).
  • Sometimes you can fix this error by re-ordering operations. For example, 60!*30!/20! will return an overflow error, but 60!/20!*30! will not.
  • This error is not returned when graphing (see the note at the top of the page).

R

RESERVED

S

SINGULAR MAT

  • A singular matrix (determinant = 0) is not valid as the argument for -1.
  • A regression generated a singular matrix (determinant = 0) because it could not find a solution, or a solution does not exist.
  • This error is not returned when graphing (see the note at the top of the page).

SINGULARTY

  • The expression in the solve( function or the equation solver contains a singularity (a point at which the function is not defined). Examine a graph of the function. If the equation has a solution, change the bounds or the initial guess or both.
  • Although the correct spelling is "singularity", the error message shown has "singularty" on all calculators and OS versions.

STAT

  • You attempted a stat calculation with lists that are not appropriate.
  • Statistical analyses must have at least two data points.
  • Med-Med must have at least three points in each partition.
  • When you use a frequency list, its elements must be at least 0.
  • (Xmax - Xmin) / Xscl must equal 47 for a histogram.

STAT PLOT

  • You attempted to display a graph when a stat plot that uses an undefined list is turned on.
  • To fix this error, use the command PlotsOff to turn off plots when you're using the graph screen.

SYNTAX

  • The command contains a syntax error. Look for misplaced functions, arguments, parentheses, or commas. See the appropriate command page.
  • This error will also occur in place of a DATA TYPE error if the variable type in question is a variable name (with seq(, solve(, For(, and other commands)
  • The command was attempting to get expr( of a non-value string, i.e., trying to evaluate a space, equals sign, etc.

T

TOL NOT MET

  • You requested a tolerance to which the algorithm cannot return an accurate result.

U

UNDEFINED

  • You referenced a variable that is not currently defined. This error doesn't occur with number variables (A-Z,θ), which have a default value of 0.
  • Lists, matrices,strings,pictures, and GDBs have to be stored to first, in order to be used.
  • Most system variables always have a value, so this error doesn't apply to them.
  • However, statistical variables are undefined except for those used by the last relevant command.
  • Undefined equation variables (such as Parametric and Polar variables) return ERR:INVALID instead of ERR:UNDEFINED.

V

VALIDATION

  • Electrical interference caused a link to fail or this calculator is not authorized to run the application.

VARIABLE

  • You have tried to archive a variable that cannot be archived or you have have tried to unarchive an application or group.
  • Variables that cannot be archived include:
    • The number variables R, T, X, Y, and θ (because they are used for graphing)
    • The list ∟RESID (because it's reserved for residuals from regression models)
    • System variables (including statistical variables, finance variables, equations, plots, and window variables)
    • The AppIdList.

VERSION

  • You have attempted to receive an incompatible variable version from another calculator.

W

WINDOW RANGE

  • A problem exists with the window variables.
    • You defined Xmin>Xmax or Ymin>Ymax.
    • Xmin and Xmax (or Ymin and Ymax) are equal or so close that numerical precision can't allow for enough values between them.
    • The values for θmin, θmax, and θstep create an empty or never-ending loop for θ.
    • The values for Tmin, Tmax, and Tstep create an empty or never-ending loop for T.
  • When this error occurs, the option 2:Goto doesn't show up.

Z

ZOOM

  • A point or a line, instead of a box, is defined in ZBox.
  • A ZOOM operation returned a math error.
  • When this error occurs, the option 2:Goto doesn't show up.

Other

?

  • An unknown error has occurred.

This page is a guide to the template pages.

{$picture}

Command Summary

{$summary}

Command Syntax

{$syntax}

Menu Location

{$location}

Calculator Compatibility

This command requires a calculator with Flash memory (that is, it will not work on a TI-92).
Calculator Compatibility

This command requires a calculator with AMS version 2.{$ams2xx} or higher (it will also work on any TI-89 Titanium or Voyage 200 calculator)
Calculator Compatibility

This command requires a TI-89 Titanium or Voyage 200 calculator with AMS version 3.{$ams3xx} or higher.

Token Size

{$size}

toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it. I will get around to finishing this, probably during the Summer Holidays. ~ James Kanjo

Multiplayer is where two or more people play a game together at the same time. Although you can create AI opponents for a player to play against, AI does not offer as much fun compared to playing against other human opponents — you can have the players work together, compete against each other, and even one player manage the other players.

Multiplayer games are generally divided into two categories: the players share a single calculator, and the players each play on their own calculator connected together with a link cable (either I/O or USB).

Single-Calculator Multiplayer

Multiplayer games on one calculator generally fall into two categories: real-time and turn-based. Real-time is where the game action is constantly changing, not stopping for the player input. Some classic examples of real-time games are Galaxian and Pong. Turn-based is where each player is allowed to make a move, and the game action only changes after each player has moved. Some classic examples of turn-based games are Battleship and Scorched Earth.

Making real-time games involves using the getKey command, except you can't wait for a key to be pressed. The general form is something along the lines of:

While <game not done>
getKey->K
If K=<player 1 key>:Then
// player 1 action
End
If K=<player 2 key>:Then
// player 2 action
End
<Update rest of game>
End

As you can see, the player action only occurs when a player has pressed a particular key; otherwise the game just continues on like regular, with the main game loop being repeated over and over again.

There are some problems with making real-time games, however.

The first, and foremost, problem is that TI-Basic is rather slow with user input. If you do anything remotely time-intensive, such as displaying lots of graphics or complex variable manipulation, then there will be some lag-time between when a player presses a key and when the calculator gets around to processing it. Although there's not really much you can do about this, you can make sure your game is as optimized as possible (especially breaking the more time-intensive parts into their own subprograms).

The second problem is that the calculator only keeps track of the last key pressed since the last time getKey was executed, so that means only one player can have their input read and processed each time through the game loop. In addition, if you enter a large block of code for the player, it will take a while before the other players have a chance to do anything.

Related to the second problem, the third problem with making real-time games is that unlike the other keys, the arrow and DEL keys can actually be held down, which will cause them to keep being repeated until they are unpressed. The effectively disables the other keys from being able to be pressed. There is no viable way to get around this problem, except asking the players to not press those keys.

The fourth problem is that the keypad is quite small, and having two or more people try to share the calculator can be rather difficult. The best way to work around this problem is choosing keys for each player that are a good distance away from each other. When choosing keys you should also keep in mind the calculator screen — if somebody has to press keys that make it difficult to see the screen, then you should choose different keys.

Because making real-time games is not very practical, a better alternative is turn-based games: you hand the calculator from player to player, allowing each each player to move one at a time. These games are much easier to program: you simply use a variable to keep track of whose turn it is, increment the variable after each player's turn, and when everybody has completed their turn, you reset the variable. The only real downfall of turn-based games is that they can be slow because you have to wait until the other players are done before you can move.

Multi-Calculator Multiplayer

So I guess you're wondering how to program a multi-calculator multiplayer experience into one of your games. One of the first things you will need to do is familiarize yourself with the GetCalc( command. Basically, it retrieves a specified variable from another calculator and stores it to that variable on yours.

Creating multiplayer programs over two calculators is a much less simple process as it is to make single-calculator multiplayer programs. However, doing so could be the main selling point of your program and would certainly be worth the effort. You will notice that in each of our examples we tend to transfer lists, which we recommend you do too. Whilst it is possible to transfer a variety of real variables, it is much faster to transfer a list of numbers than a number of real variables.

There are two general ways to programming multi-calculator programs; one screen processing and two screen processing. The one screen processing method is simply making a program use the statistics from another calculator, and the whole multiplayer experience is processed on that calculator. The two screen processing method is much more complex, where we can share the multiplayer processing across two calculators by using a "turn-by-turn" interface.

Core

When it comes to multi-calculator multiplayer games, it is absolutely necessary to give each calculator its own identity. As both calculators are running the exact same program, we need a way to be able to determine one calculator as "Calculator A" and the other calculator as "Calculator B". This makes it possible for both calculators to know what data to send and receive. For example, if both calculators were "Calculator A", then both calculators would be doing exactly the same thing, or keep trying to receive the same variable from each other in an endless loop

This is code determines which assigns each calculator with a unique identity:

:GetCalc(A
:e(A=π)+π(A≠π→A

How it works is that the calculator gets the variable A from the other calculator, and checks whether it equals π (pi). If A equals π, then e is stored to A; however, if A does not equal π, then π is stored to A. Here is a table to demonstrate the results:

Calculator A Calculator B
A = π A = e
A = 3.141592654 A = 2.718281828

The calculator can therefore identify itself like this:

:If A=π:Disp "I'M CALC A
:If A=e:Disp "I'M CALC B

If we use a not( routine to make Calculator A = 1 and Calculator B = 0 instead, then we are unable to determine whether a link has been initiated. Simply explained, because variable A is more likely to equal zero than any other number, Calculator A may accidentally assume Calculator B has initiated the multi-calculator sequence. Variable A is not likely to ever equal π (or e), which is why it's useful as a "connection initiated" checker for the calculator.

The beauty of the core code is that it doesn't matter which player executes the core code first, both calculators will be able to give themselves a unique identity, be able to distinguish which calculator they are and be able to see whether the other calculator is initiated yet.

One Screen

If you are looking to save space and valuable time, this is the multiplayer for you. This method has the sending calculator in a power-saving state the whole time while the receiving calculator does all of the hard work such as processing and animation.

First off, we put in the core multiplayer code to determine which calculator is which. Then, Calculator B will retrieve the opponent's statistics for battling. Because the program uses the same variables on every calculator, we need to find a way to store Calculator A's statistics onto Calculator B without overwriting Calculator B's statistics. Surprisingly, this is not as hard as it seems:

:GetCalc(A
:e(A=π)+π(A≠π→A
:If A=π:Then
:∟STATS→L₁
:Disp "SENDING DATA...","PRESS ENTER WHEN
:Pause "FINISHED
:End

Now that each calculator has created its unique identity, and Calculator A has stored its statistics to L₁, we can finally make Calculator B receive Calculator A's statistics and process all of the data:

:If A=e:Then
:GetCalc(L₁
<interactive code>
:End

After this, write the rest as though this was a single-calculator multiplayer game, where you're statistics are in ∟STATS and your opponent's statistics are in L₁. Here is a side-by-side comparison on how the program runs:

Calculator A Calculator B
1SCREEN-A.gif 1SCREEN-B.gif

Two Screens

Here we show you a turn by turn based method of a battle game.

Like with all multi-calculator multiplayer programs, we first provide the program with the core. This time, however, we will first reset variables A and F. Then we will add code for which stores each calculator's statistical data to its individually named list. Calculator B is then instructed to go elsewhere in the program (note that Goto is within an If-Then loop):

:DelVarADelVar FGetCalc(A
:e(A=π)+π(A≠π→A
:If A=π:Then
:∟STATS→L₁
:Else
:∟STATS→L₂
:Goto W
:End

Because this is turn by turn battle game, we need to repeat the battle code until the battle is finished. We will make variable F determine this. Also, we want Calculator A to be able to attack first, so we shall put the code for attacking as the first thing in the Repeat loop. This is where it starts to get a bit sticky. First we delete variable B, which is going to determine what command the user has chosen (whether it be a kind of attack, or to run away).

:Repeat F
:DelVar BMenu("CHOOSE ATTACK","ATTACK A",A,"ATTACK B",B,"RUN AWAY",R
:Lbl A:1→B:Goto S
:Lbl B:2→B:Goto S
:Lbl R:‾1→B
:Lbl S:1→θ

So when the user selects an option from the menu, a number is stored to B and 1 is stored to θ. Theta tells the receiving calculator that it the sending calculator is not ready yet. Then we create a second menu. This is to give the receiving calculator a chance to receive certain variables. That process is almost instant, and so the user then presses ENTER. θ is erased and 1 is stored to S, just before the "animation" program starts. S simply tells the animation program that it has just sent the attack.

:Menu("SENDING ATTACK","READY?",SA
:Lbl SA:1→S
:DelVar θprgmθANIMAT

The animation program is shared by both the attacker and the attacked. The program makes particular animation depending on whether variable S is equal to one. If S=1, then this program will only display the opponent getting hurt. If S=0, then this program will display YOU getting hurt, calculate how much HP you have left, and if you died, sets variable F to zero. By using the subprogram "prgmθANIMAT", it means we don't need to worry about memory leaks or program changes.

Now we have the receiving code. You will notice that Lbl W is the first line here. This is so that Calculator B can jump straight here on the first move. Because this label is within a repeat loop, and the Goto came from an If-Then section, there are no memory leaks. The first thing we do is make the program wait until the sending calculator has issued a move. If the game is over (F=1), then this process stops, and the program exits the "Repeat F" loop. If the game is not over, and the opponent issued a move, then the calculator receives the opponent's updated statistics.

:Lbl W:Disp "WAITING...
:DelVar BRepeat B or F
:GetCalc(B
:GetCalc(F
:End
:If not(F:Then
:If A=e:GetCalc(L₁
:If A=π:GetCalc(L₂

At the moment upon entering the loop, we know that the opponent's θ equals 1. In this loop, we clear our θ variable and then retrieve the opponent's θ. Because of the nature of GetCalc(, we can not receive variables whilst the other calculator is processing. Remember that as soon as the other calculator exits the "SENDING ATTACK…" menu, the animation subprogram starts.

Using this knowledge, if we delete θ and then retrieve θ whilst the opponent is in the "SENDING ATTACK…" menu, θ will equal 1 (and hence the loop is repeated). But when the opponent starts the animation process, we will be unable to retrieve θ, and so θ will equal what it all ready was, zero (hence we exit the loop).

:Repeat not(θ
:DelVar θGetCalc(θ
:End
:DelVar SprgmθANIMAT
:End
:End

This code is rather remarkable because it makes it possible to start the animation on both calculators, at the same time, automatically. You don't need to go messing about with "both users press ENTER at the same time" routines, only one user needs to press ENTER and both calculators begin — a foolproof technique.

If, after the animation process, the battle is not yet over, then the program continues into attack mode again (at the start of the "Repeat F" loop).

Now we need a routine which restores the statistics to the ∟STATS list and says who won after the battle is over! This is the easiest part of the routine. If the player's health points do not equal zero, then that player won — otherwise the other player won.

:L₁
:If A=e:L₂
:Ans→∟STATS
:If Ans(6:Then
:Pause "YOU WON!
:Else
:Pause "YOU LOST!
:End

There are a couple of things that you need to be aware of for this routine to be work:

  1. When the "SENDING ATTACK" menu pops up, you must wait for a second for the attack to actually send before pressing ENTER;
  2. Variable A must NEVER equal π during the program, (obviously with the except of the multi-calculator code itself). If it does, and a different calculator starts this routine before the other one, then the link process will fail.

To prevent the second problem from ever happening, you should reset variable A at the start of your program, and never use this variable throughout the program.

This whole routine is certainly complex, but it does work, and works pretty well too. Here is a side-by-side comparison of how the program runs. For reference, here is a table showing the values:

Calculator A Calculator B
Max HP ∟STATS(1)=2 ∟STATS(1)=5
Level ∟STATS(2)=2 ∟STATS(2)=5
Attack ∟STATS(3)=2 ∟STATS(3)=5
Defence ∟STATS(4)=2 ∟STATS(4)=5
HP ∟STATS(6)=2 ∟STATS(6)=5
Calculator A Calculator B
1SCREEN-A.gif 1SCREEN-B.gif

Final Notes

Whilst the abilities of the GetCalc( command make it harder to create multi-calculator programs, it certainly is not impossible. You just need to think extra hard and create very clever workarounds to its boundaries.

If you have any questions or comments about these routines please ask in the discussion area for this page.

References

  • James Kanjo came up with the "Multi-Calculator Core" code in his IM program, and also came up with the "turn by turn battle" code, including the function to make one calculator respond to another calculator's ENTER keypress
Forum 101
Category nameThreadsPostsLast post
1969by BattlesquidBattlesquid
23 Apr 2018 03:10Jump!
Introduce yourself to the community
2251189by TrenlyTrenly
20 Sep 2018 23:11Jump!
Questions and commentary about the site
1932094by CloudVariableCloudVariable
20 Sep 2018 21:02Jump!
Questions about certain wiki pages
9673998by Dylan VillegasDylan Villegas
20 Sep 2018 14:35Jump!
General Discussion
Category nameThreadsPostsLast post
You can talk about anything
3542531by Bio_Hazard1282Bio_Hazard1282
15 Sep 2018 01:08Jump!
Post a funny picture or joke
37356by Myles_ZadokMyles_Zadok
31 Aug 2018 20:48Jump!
Arguments and rants welcome
10225by KydapootKydapoot
26 Mar 2016 19:46Jump!
Get help with your technology questions
2881993by Bio_Hazard1282Bio_Hazard1282
15 Sep 2018 01:26Jump!
Programming & Design
Category nameThreadsPostsLast post
Discuss TI-83/84 topics
163313170by CloudVariableCloudVariable
18 Sep 2018 23:34Jump!
Discuss 68k topics
94506by kg583kg583
30 Jun 2018 16:50Jump!
Discuss TI-Nspire topics
205914by AbduBasheerAbduBasheer
06 Aug 2018 09:22Jump!
Discuss Assembly topics
1771244by absoluteAquarianabsoluteAquarian
15 May 2018 15:38Jump!
Discuss computers and web development
74508by Thel 'Vadamee (guest)
17 May 2017 20:38Jump!
Projects & Contests
Category nameThreadsPostsLast post
Share your projects
1742097by BattlesquidBattlesquid
14 Sep 2018 21:24Jump!
Share your project ideas
82971by DeoxalDeoxal
20 Sep 2018 17:07Jump!
Seeing who can create the best program...
731251by Bio_Hazard1282Bio_Hazard1282
18 Sep 2018 12:58Jump!
Test your command knowledge
4468by TrenlyTrenly
09 May 2018 23:17Jump!
Test your optimization prowess
42496by TrenlyTrenly
05 Aug 2018 03:43Jump!
Try to stump others
11522by TrenlyTrenly
04 Sep 2017 00:43Jump!

Show hidden

rss icon RSS: New threads | New posts

toolbar-separator.png This article is part of the coding stage of the development cycle.

Code conventions are a set of guidelines for writing programs, primarily focusing on the structure and appearance of the code. Although code conventions are generally subjective and informal, just the individual preferences of each programmer developed over time, there are several common conventions that most programmers follow and are considered to constitute good programming practice.

Following code conventions not only makes your code consistent, helping to make it easier to read and understand, but also eliminates a lot of the difficulty in maintaining it. Code conventions are also important in group projects, where multiple people are working together and everybody needs to be on the same page.

Naming

The general convention for naming programs, subprograms, labels, and custom lists is to choose a name that tells you what it is (in the case of programs and subprograms) or that relates to how it is used (in the case of labels and lists).

For example, if your program is a Minesweeper clone, then a good program name is something like MINES. If your MINES program has a subprogram, start it with θ or Z so that it appears at the bottom of the program list.

If you have a highscore function built-in to your game, then you should use a custom list that is related to your program's name (i.e., LMINE would make sense for the MINES game mentioned above).

In the case of a label name, you should make it mnemonic — Lbl UP would be an appropriate choice for the code that moves the screen up.

Formatting

The general convention for formatting code is to place related statements together on the same line. This is most applicable with variable declarations, If-Then conditionals, and short loops, although you can certainly put whatever statements that you want.

The way you get multiple statements on the same line is by separating each one with a colon, which is also used to denote the beginning of each new line. The program editor on the calculator allows sixteen characters per line, so if the statements are wider than that, they will cause the line to wrap around to the next line (and however many more lines are needed).

Structure

The general convention for structuring code is to use a loop, except for those situations where using a loop is impractical; in those cases, using a Goto is the preferred convention.

When deciding which loop to use, you need to look at what its functionality will be. If you want the loop to be executed a set number of times, then you should use a For( loop. If you want the code inside of the loop to be executed at least once, then you should use a Repeat loop.

The While loop is very similar to the Repeat loop, so the way to decide when to use either one is by thinking of the loop condition. If the loop is going to keep running as long as the condition is true, then you should use a While loop. If the loop is going to run until the condition is true, then you should use a Repeat loop.

Variables

The general convention for using variables is to use the most appropriate variable whenever possible. There are several different kinds of variables available, including reals, lists, matrices, and strings, and they each have their own time and place.

Reals are used for keeping track of one value, and because they are both small and fast, you should use them before using other variables. Lists are used for keeping track of multiple values, and because they can be created, you should use them for saving highscores and other important data.

Matrices are used for keeping track of two-dimensional values, which means you should use them for making maps on the screen. Strings are used for keeping track of characters, which means you should use them when you want to display text on the screen.

Sample Program

The following sample program is a modified form of the program on the movement page. The main things you should notice are the real variables grouped together on the first line and the use of the Repeat loops for the code structure.

PROGRAM:MOVEMENT
:4→A:8→B
:Repeat K=105
:Output(A,Ans,"X
:Repeat Ans:getKey→K:End
:Output(A,B," "
:A+(Ans=34)-(Ans=25
:Ans+8(not(Ans)-(Ans=9→A
:B+(K=26)-(K=24
:Ans+16(not(Ans)-(Ans=17→B
:End
<< Program Setup Overview Techniques >>

[[include inc:command
|picture=@@
|summary=@@
|syntax=@@
|location=@@
|compatibility=@@
|size=@@
]]

|picture=

If the image is embedded on the same page, then only the full name of the image is to be written here. Otherwise, simply paste the full URL of the image.

|summary=

Just type in a brief description of the command

|syntax=

Enter the general syntax of the command

|location=

Give step by step instructions of how to paste the command into the program. Separate each step with a new line, beginning each line with a # and a space following it. For example:
# Step One
# Step Two

|compatibility=

Enter the calculators compatible with a syntax similar to the example used for all calculators: TI-83/84/+/SE

|size=

Just enter the number of bytes the token takes up, and the word byte or bytes. For example, |size=1 byte or |size=2 bytes

[[include inc:68k-command
|picture=@@
|summary=@@
|syntax=@@

|size=@@ |hex=@@
]]

In general, omitting all the variables for a section is the way to go if you don't want the section to be displayed. The exception is "calculator compatibility" - omitting the variables for that section will display the default message (compatible with all calculators).

|picture=

If the image is embedded on the same page, then only the full name of the image is to be written here. Otherwise, simply paste the full URL of the image.

|summary=

Just type in a brief description of the command.

|syntax=

Enter the general syntax of the command.

Menu Location

This section depends on the type of menu location:

Simple key press

|simplekey=(key)
|command=(command)

Key press varies across models
|ti89key=(key on TI-89 or TI-89 Titanium)
|ti92key=(key on TI-92, TI-92+, or Voyage 200)
|command=(command)

Popup menu
|popuptitle1=(popup menu title)
|popupkey1=(the key for that menu)
|popuptitle2=(submenu title - OPTIONAL)
|popupkey2=(key for that submenu - OPTIONAL)
|popuptitle3=(sub-submenu title - EVEN MORE OPTIONAL)
|popupkey3=(key for that sub-submen - ALSO OPTIONAL)
|laststepkey=(key to finally paste the command)
|command=(command)

Toolbar menu
|toolbar=(toolbar name: program editor, home screen, or graph screen)
|tooloption=(toolbar option name - e.g. F2 - I/O)
|toolmenu=(toolbar submenu - OPTIONAL)
|toolmenukey=(key for the submenu - OPTIONAL)
|laststepkey=(key to paste the command)
|command=(command)

Compatibility

If the command works on all calculators, nothing needs to be done. Otherwise add one of the following:

  • |flashrom=1 if the command requires Flash ROM
  • |ams2xx=yy if the command requires AMS version 2.yy
  • |ams3xx=yy if the command requires AMS version 3.yy (on a TI-89 Titanium, or Voyage 200)

Only one option can be applied (and they are exclusive of each other), otherwise unpredictable results may occur.

Size

If you wish to include the token size section, you need to make the size tag equal to the number of bytes it takes up, plus the word "byte" (or "bytes" if it takes up more than one byte). For example, |size=1 byte or |size=3 bytes

To enter details of token size, specify the hex code for the command itself (hex=0x##) as well as any of the tags that apply to that command: |EXT_INSTR_TAG=1, |EXT_CMD_TAG=1, and |END_TAG=1 for the respective tags.

{$picture}

Program Summary

{$summary}

Program Size

{$size}

Uses Libraries?

{$libraries}

Calculator Compatibility

{$compatibility}

Author

{$author}

Download

{$download}

{$picture}

Routine Summary

{$summary}

Inputs

{$input}

Outputs

{$output}

Variables Used

{$variable}

Calculator Compatibility

{$compatibility}

Author

{$author}

Authors

{$authors}

URL: [{$url}]

Download

[{$download}]

Welcome to the TI|BD Sandbox! A Sandbox is basically a place where you can trial pages/features/whatevers to see whether they will work, before you actually release it to its appropriate section on the site.

Start a new page:

All pages currently under the "Sandbox" category:

The ListPages module does not work recursively.
{$picture}

Command Summary

{$summary}

Command Syntax

{$syntax}

Menu Location

{$location}

Calculator Compatibility

{$compatibility}

Token Size

{$size}

This page includes all pages within the "SK" category.

The ListPages module does not work recursively.

This page includes all pages within the "Nav" category.

The ListPages module does not work recursively.

This page includes all pages within the "Forum" category.

The ListPages module does not work recursively.

This page includes all pages within the "Admin" category.

The ListPages module does not work recursively.

This page includes all pages within the "System" category.

The ListPages module does not work recursively.

This page includes all pages under the "Template" category.

The ListPages module does not work recursively.

This is the page with a list of deleted pages.

The ListPages module does not work recursively.

This page contains a list of all pages withing the "inc:" template. See the GUI version here.

The ListPages module does not work recursively.

krazyness suggested that it would be a good idea to implement a site logo, to replace the current header of the TI|BD wiki. He took the liberty to design and produce the logo. There was much discussions relating to the design of site logo (which can be found here) which led to modifications and new versions, each an improvement from the last. The people who have actually produced the possible logos for the wiki are krazyness, James Kanjo, DarkerLine, and Battlesquid.

Original Header:

This was the original header which krazyness set out to replace.

Logo00.PNG

Version 1:

krazyness
Produced the original logo design for the site (his own design).

Logo01.PNG

Version 2:

krazyness
Manipulated the first version to render the letters "A" in "Basic" and "V" in "Developer" in a higher quality.

Logo02.PNG

Version 3:

krazyness
Rendered the image based on the colours of the wiki, #172028 and #E7E9DC.

Logo03.PNG

Versions 4-9:

James Kanjo
Uses 'very sophisticated photo editing software' (MS Word) to improve the image quality of the logo. Shrunk the height to 63 pixels, because he misread the discussion on the logo, and thought it said to be 63 pixels high instead of 67 pixels high:

Logo04.PNG

Variation with the text gradient dark at the bottom and light at the top:

Logo05.PNG

Variation with different colours which are relative to the site:

Logo06.PNG

Changed the lighting and shadows of version 5. Changed the height of the image to 68 pixels, as that was thought to be the necessary height of the image to fit properly. Added a gradient in the background which fades to the colour #172028 over a length of 32 pixels:

Logo07.PNG

Changed the height of version 6 to 68 pixels for the same reason mentioned in version 7. Adjusted lighting. Added a gradient in the background which fades to the colour #172028 over a length of 32 pixels:

Logo08.PNG

Modified the gradient in the text of version 8 to focus the light in the middle and darkness on the outsides:

Logo09.PNG

Version 10:

Version 10A:
James Kanjo
Realised that the height of the logo should in fact be 67 pixels in height. Made the text look more 'polished' by making it brighter in the middle of the text. Shrunk the main header text. Added subtitle "The TI-Basic Information Repository". Changed the gradient to fade into the colour #172028 over a length of 200 pixels rather than 32.

Logo10A.PNG

Version 10B:
James Kanjo
Increased the height in pixels to be 69 pixels high, because the browser Internet Explorer showed a pixel row that should have been hidden, and so that there is no black pixel row at the bottom of the logo on forum pages. The difference is negligable to the human eye, but it is definitely noticeable when placed in the header.

Logo10B.PNG

Version 10C:
DarkerLine
First try at making a 68k version of the logo.

Logo10C.PNG

Version 10D:
Battlesquid
An attempt towards creating an Nspire header. Traces of blue are on the logo's letters, so that is yet to be resolved.

Logo10D.PNG

Version 10E:

Battlesquid
Made a successful attempt towards creating an Nspire logo to go with the agreed upon theme.
Logo10E.png

Note: Downloading programs is only necessary if you are looking for programs to use on your calculator. If you are just interested in TI-Basic programming, please skip this page and move on to the Variables page.

Before downloading any programs, you should create a folder to store the programs. Where you decide to store this folder is up to you, but the two most common places are the desktop or hard drive (typically the C: drive). Storing folders on the desktop is very convenient, allowing you to quickly access a program without having to hunt and search for it, but the desktop can easily become cluttered with programs and other files.

Within the folder itself, you should give each program its own folder and also create a downloads folder to contain the .zip files that the programs are contained in when you download them (see below for more information about .zip files). Although you could put each .zip file with its respective program, it is better to separate them in case you want to delete the program folder but still keep the program for later use.

When naming the program folders, you should use the full program name and include the version number of the program. This is important because there might be several similar programs — for example, snake games are a dime a dozen — and there might be more than one version of the program. Having the version number in the program folder name allows you to easily determine if you have the latest version of the program.

What to Download

While there are several calculator sites on the Internet that have programs, the sites with the largest program archives are ticalc.org, calcg.org, and unitedti.org. Each of these websites has many different kinds of programs available, including math, science, utilities, graphics, and games, and you can generally find whatever it is that you are looking for. There is a wide range of quality among the programs, however.

Most programs are hit and miss — you don't know if the program will be any good until you download and try it out. There are some simple indicators that you can use to gauge a program's quality: the number of downloads, the rating (if available), the reviews (if available), and the screenshots (if available). None of these is really foolproof, however, because they can be manipulated by the program author.

Generally speaking, assembly programs are of higher quality than TI-Basic programs. This is due to the fact that assembly programs are programmed in the calculator's own machine language, which is more difficult to learn, but allows for much greater speed and functionality. Consequently, most people programming in assembly are fairly decent programmers, and thus most assembly programs that you will find are good quality.

TI-Basic, on the other hand, is simple enough that almost anybody can make programs using it, so there are lots of programs available; the large sites listed above are literally flooded with TI-Basic programs. This is good if you like variety, but most of the programs are of subpar quality, featuring crappy coding, gameplay, and graphics. If you are looking for quality TI-Basic programs, your best bet is to check out the programs on the showcases page.

Opening a Zip File

When downloading a program, it will typically be packaged inside of a .zip file. A .zip file is used to group one or more individual files together for easier downloading, while compressing them to reduce their size. An average program, for example, includes the main program itself, some subprograms, screenshots of the program, and a readme document describing the program and how to use it.

In order to use the contents of a .zip file, you need to "unzip" it using a zip utility program. There are several different zip utility programs available, but which program you are able to use depends on your operating system. The most popular zip program for Windows is WinZip, while the most popular zip program for MacOS is StuffIt Expander. After you download a zip program, you need to run the executable (i.e., the .exe file) to install it.

Once you have your zip program installed, you can begin unzipping your programs. This is actually quite simple, and just involves right clicking a .zip file, arrowing down to the zip program that you installed, and clicking on an extract option. There will generally be a few options for where you can extract the .zip file: the same location as the .zip file, to a specific folder, or to anywhere you want. Of course, since you have your programs folder, you should unzip your programs to that folder.

Using a Program

Although there are usually several files inside of a .zip file, calculator files are the only ones that you can actually use and send to your calculator. There are several different calculator file types available, including programs, groups, images, lists, matrices, strings, Flash applications, and even operating systems, but not all of those are available on every calculator.

Each TI calculator has their own set of file extensions that they work with: the pattern that file extensions follow is the first two characters are the calculator, and the third character is the file type. The regular calculators (such as the TI-83) use the calculator number for the first two characters, while the plus calculators (such as the TI-83+) use the first number and a letter. For example, a file extension of .8xp means that the file is for a TI-83+ or TI-84+, and it is a program.

Besides having the calculator files for the program, you should also read through the readme document that came with the .zip file (if there is one). Although most TI-Basic programs do not require any additional programs to run, some do require assembly libraries (such as xLIB). The majority of assembly programs require a shell, such as MirageOS or Ion. You should check to see what requirements the program has, and download the appropriate files.

Once you have all of the required files to use the program, you can send them to your calculator. This requires a TI-Basic editor (either Graph Link or TI Connect) and a calculator-to-computer link cable (either TI-Graph Link or USB Link). If you are using Graph Link, you just open it up, click the Send menu option, select your files, and click Send. Using TI Connect is similar, except you drag and drop the files to the desired location.

If you don't have a calculator-to-computer link cable, another option is to type the files into your calculator manually. You just open a TI-Basic editor (or use SourceCoder), find the program files in the appropriate directory, and then type in the individual commands. Depending on the size of a program, this can take anywhere from a couple minutes to several hours. This option does not work with assembly programs, however, since they are written in machine code and compiled.

<< Computer Setup Table of Contents Variables >>

The game loop is the fundamental structure of most games. It repeats throughout the game, managing all necessary information and user input. Of course, the game loop will be different depending on the type of game. In a shooting game, it might loop continuously, tracking player movement if there is any, and frequently moving enemies and updating scores and such. In a chess game, it might loop once for every turn, waiting for user moves and updating the positions of pieces only when one is moved, or it might loop every second if a timer is implemented. In general, however, it will usually look like this:

while the player has not won:
 update game information (for example, score or turn count)
 accept user action
 update game status (for example, locations of pieces/units/player)
 display relevant information

There are four main types of loops used in programs. There are For( loops, While loops, Repeat loops, and Goto loops. The first three are the most commonly used whereas the Goto not so much. You probably already read about loops in the previous chapter, but this discusses the fundamentals of each loop in detail and displays the application of such things when referring to game building.

While Loops

This loop is the most basic loop. What you do is put a condition after it, and while that condition is true, the loop will continue to run between the While and its End until the condition becomes false. So, when the calculator encounters a While, it tests the condition after it and depending on whether it is true or not, the calculator will either execute the loop or skip it. If it executes the loop, it will continue to do so until the condition after While becomes false. Let us consider this code:

:3→A
:While A<10
:A+1→A
:Disp A+1
:End
:Disp "Finished"

This code, of course, initially stores 3 into A. Then, it encounters the While loop. What the program then does is tests the A<10. If it is 1 (or true), then it will execute the next commands. If it is 0 (or false), then it will skip to the End and continue from there. In this case, 3<10 is true, so it begins the loop by executing the following commands. A increases by 1, and then it displays one more than that value. So, it displays 5, but A is 4. When the program reaches the End, it then tests A<10 again. If it is true, then it will execute the commands again. If it is false, it will continue after the End. So, since 4<10, it will do the loop commands again. So it now displays 6. It will continue to do this until A is equal to or greater than 10. So, once A becomes 10, the program will display "Finished!".

That is the essence of loops: repeating a group of commands while or until a condition becomes true, or when something specific occurs.

While loops are good for elimination games where while player is still alive, his turn commences. If the player is eliminated, then it would skip the loop. Another reason for a While loop is as a sub loop where an action from the user determines the usage of the second loop. If the action doesn't involve the loop, then the loop can be skipped.

Repeat Loops

The Repeat loop is almost the same as the While loop, but there is a difference. First of all, the repeat loop will continue to loop until the condition after it is true. So, if the condition is not true, then it will continue to loop until that condition becomes true. Another difference is that when the calculator encounters a Repeat, it doesn't scan the condition. It will automatically start the loop and test the condition when it reaches the appropriate end. When the calculator reaches a Repeat, it cannot be skipped. Consider the following code:

Note:
The difference between a While loop and a Repeat loop is that the While can be skipped depending on the condition. A Repeat loop is always executed regardless of initial condition.

:15→A
:Repeat A=15
:A=15→A
:Disp A
:A+2→A
:End
:Disp "Finished"

This code firsts stores 15 into A. Now, it begins the loop. Since it is a Repeat loop, the loop is automatically executed even though the condition is true. Since A is 15, the Boolean logic becomes 1 and is stored into A. The first display is 1. The program then adds two to A. When it reaches the End, the loop goes back to the condition and tests it. It will continue through the same cycle until the A becomes 15. When that happens, the program displays "Finished".

Repeat loops are typically used as the main, or base, loop of the program or action. The reason for this is so the loop becomes automatically executed rather than being skipped. Also, the mentality of a game loop is to continue gameplay until the person dies/loses. With this mentality, the condition is easily depicted as the situation when the player loses making the loop end at that instance.

For( Loops

This loop is not like the others, and it is a little more complex. This loop requires 3 arguments with one optional argument. When writing a For( loop, you use this syntax:

For(variable,start,stop,[increment])
If increment is not given, the calculator assumes it is one

What the loop does is it first stores the start number into the variable. Then, it runs through the commands until it reaches End. When End is reached, the calculator loops to the For, adds increment to the variable value, and runs through the commands again. The loop continues to run until stop is reached. When that number is reached, then the calculator will proceed executing commands after the End.

Consider this code:

:For(A,2,6)
:Disp A
:End

This code starts the For( loop by giving A the value of 2. After it displays the two, the program adds one to A and displays again. It continues to add one until it hits 6. When that happens, the program runs through Disp one more time and ends the loop.

This type of loop can become incredibly useful in games. If the user makes an action where multiple things must be accomplished but of similar origin, a For( loop can be used. This loop can also be used when there is a certain number of turns being played. You could set up the loop as For(T,1,10) for a 10 turn game and put the code between the For( and its appropriate End. As you practice with this loop, you will understand exactly how useful it can become.

Goto Loops

This is probably the least common loop used in the TI-Basic community. What you do is you place a Label somewhere and later in the program put a Goto leading to the label for the use of repeating a set of commands. This type of loop requires no arguments or conditions, but it must be exited with some sort of other Goto. Although this is a relatively fast type of loop (if the Label is near the top), the positioning of the Goto could lead to some problems. The problem with goto is the event of Memory Leaks in which the calculator loses memory within the program and eventually terminates due to lack of RAM. This occurs when you have a Goto within a loop or condition that leaps to a label outside of that loop. The calculator uses memory every time it encounters a loop in order to remember that it needs to find an End somewhere. The problem is, when a Goto is used to jump out of the loop, that memory is lost because the calculator never found End. So, although useful in some cases, Goto loops are not recommended for primary game loops.

Goto and Lbl have a different purpose really. They can instead be used to locate various loops for game functionality. If you reach a condition that needs to be jumped backwards to another loop, a Goto Lbl combo can be used to easily jump back to the loop. Although dangerous, these Goto's do have a use, just be careful when placing them within loops.

Infinite Loops

An infinite loop is a loop that continues forever. The most common infinite loop is While 1. Since the condition can never be 0, the loop never ends. These loops in a game are not as useful as a terminating loop, but they can be utilized along with Goto to produce a game with a function that repeats several times regardless of status. Loops like this can be used when the player can't lose, only quit. In such situations, an infinite loop can be used and a Goto can determine when to leave (careful of memory leaks). These loops are typically replaced with a While loop that has a condition for when the player quits, but nonetheless, this loop can be used only sparingly.

Application

So, how can these loops be applied to making a game? Well, for BASIC games, loops are often needed for repetitive or continued tasks. A loop can be put somewhere near the beginning, and that loop can continue to run until the player loses. The main loop is the Repeat loop. It is typically used as the base for games. The conditional used after the loop is typically like this:

:Repeat (player dies/loses) or (getKey value)=45
code code code
:End

This way, when the player loses, the loop ends, or when he clicks Clear, the loop ends. The content of code code code could be anything really, but it typically follows a pattern found in many basic games. The code usually starts with updating the game stats and output. This is used mainly for turn based games as most games will update the information at the end of the code. Then, the program should ask or give opportunity for user input, accept it, and take action upon it. After that, the game should update output and other game stats or allow an AI to activate.

This is a list of the basic game types and what types of loops can be used to accomplish these actions.

Action

An action game is one where the playing field is constantly changing whether the player does something or not, and depending on the input, other things on the field react to the action of the user. These types of games can be quite challenging because of the constant update. The reason is because of the additional coding put under the same loop as the input selection, usually getKey. This slows down the system's ability to accept user input.

So, let's say you wanted to make a game where if X became 0, you lost, or if you hit getKey, the game ended. X is 5 when you win. Also, there are multiple things occurring even if the user takes no action. You can use the following code

:Repeat X=0 or X=5 or Ans=45
:Output(A,B,"_")
:min(8,max(1,A+sum(ΔList(Ans={25,34}))))→A
:min(16,max(1,B+sum(ΔList(K={24,26}))))→B
:Output(A,Ans,"O")
other activity coding
:getKey→K
:End
:ClrHome
:Disp "You"+sub("LoseWin!",4(X=5)+1,4)

So, we are using a Repeat loop with some conditionals after it. The conditionals represent when the game ends: when you lose (X=0), when you win (X=5), and when you quit (press Clear). The program loops through the game until one of the conditions is met. The next thing the program does is update user action info. Depending on which arrow key the player clicked, the program will move in that direction (remember from Movement?). Next, you would put other action after the update, but only put a small amount of coding, or else the least possible. The more code you put in other activity coding, the slower the game will be, and nobody likes a slow game. Finally, the game should ask for user input.

Now, it may seem weird to ask for input at the end, but it is a very useful technique. The reason the input is at the end is to use Ans in the loop conditional which makes the game run a little faster. Anywhere you can get speed makes an action game better, so try to follow this general outline. As you get more experienced, you will begin to find other alternatives to this loop as the type of game changes, but for now, this outline will help you make basic games.

Strategy/Turned Based

A strategy or turn based game is one that waits for the user input before the calculator makes any further action. In this type of game, speed is not normally as important because it is usually a thinking type game. The coding for a strategy game works in a way as described at the beginning of the article. You would need separate scores for each player. If it were an elimination type game, then a While loop can be used within a Repeat loop to indicate player turns. The loop pattern would be sort of like this:

Repeat one player is left
Update player turn by one or reset to one at max
Update player information output
While player is alive or Clear
Ask for input
act upon input
update game info
update output
End
extra stuff
End

This works by repeating the loop until one player is left and updating all player info according to previous outputs. The While loop is used for the player input. However, if the player is eliminated, then the While loop will be skipped. It will then ask for input and update that player's info accordingly.

So, putting this code to action, let us say that you are building a Risk game. You can have a Repeat loop backbone the whole game and use nested While loops for player action. Here is an example (although a rather poor one) for a Risk game where L1 is the board of 42 spaces where iPart is the number of troops and fPart is who is occupying the space, T is the player turn, and K is the getKey.

:Repeat not(variance(10fPart(L₁)))
:T(T≠4)+1→T
show stats
:While max(T=10fPart(L₁)) or K=22
:Repeat Ans
:getKey→K
:End
Update info
Update Output
:End
:End

So, this code has L1 as the whole board. Since the fPart is the occupant of the territory, then when all of the territories have the same occupant, the variance( will be 0, and since not( is used, the equation becomes 1 when the answer is 0. So, the loop ends when all territories are occupied by the same person. The While loop won't even execute if there is not a single square with occupant T. That represents that player being eliminated. So, the loop goes back to the beginning. The turns are updated for every pass, and then T=4, the turn number is set back to 1.

Limited Turns

A game with limited turns ends when a counter reaches a certain number. There are a couple of ways you can do this. You can use a Repeat loop with turn number T. When T, which is updated every loop, reaches a certain number specified in the Repeat conditional, the loop will end. Or, you can use the For( loop. The For( loop automatically updates a variable and ends when the stop is reached. So, you can set up a code like this:

:For(T,1,(last turn))
Output turn number
Update conditions
Secondary loop
Ask for User input
Update action

Pretty much, all you are doing is setting up a turn keeper and using one of the previous loop examples to run the main function of the game. Turn based games is really just an added addition to the other loops.

Conclusion

This wraps up the Game Loop tutorial. This is just the basics of making a game. In making a game, the loop only represents the backbone of the program. What lies within a loop is the meat, and that is what makes the game function. The next section deals with data types which will introduce to you the various ways we can manipulate numbers to accomplish jobs.

<< Movement Table of Contents Data Types (Intro) >>

Once you have been writing programs for a while, you may realize that you can't accomplish everything by entering numbers and strings. In a program such as a game, you often need to accept arbitrary keypresses. That's where getKey comes in.

How It Works

getKey is the 7th entry in I/O under the PRGM menu. It returns a number corresponding to the key pressed by the user.

But if you put it into a program by itself, it doesn't seem to do much - it immediately gives you a "Done". This is because getKey checks for a key only in the fraction of a second when it executes, and then returns a 0 if it doesn't find one. Commonly, it will be inside some kind of loop so that the program doesn't proceed until a key is actually pressed.

:Repeat K
:getKey→K
:End

In this case, getKey is repeatedly stored in K until a key is pressed, at which time getKey returns a positive value, which is accessible in K after the loop exits.

The number returned by getKey is formed from the row and column the key is in on the calculator. The row is from 1 (Y= to GRAPH) to 10 (ON to ENTER), and the column starts from 1 and goes left to right. The arrows left, up, and right are in row 2, and down is in row 3. 101 (ON) is not actually returnable by getKey because pressing ON in a program stops the execution of the program

Uses

Obviously, there are many ways to use key presses in a program. You can let users select a choice without having to enter a number or go through a menu. Or you can let users input a command such as CLEAR. However, be sure to let the user know what each key actually does, for the sake of usability.

Or, in a game, key presses can be used to control a character. For example, the arrow keys move a spaceship, and 2nd fires the laser. In a turn-based game the above loop method is useful, as you can create a loop for the turns and accept a user action on each turn. But in a real-time game you would probably not want to use a loop around getKey, so that the game isn't interrupted by waiting for a key. Instead, you can let the program run continuously and check once for a key once per some (short) interval of time, so user commands are still accepted correctly. For more, see the next section.

The reason this works is that even if the key press doesn't line up with getKey exactly, if a key is pressed while the calculator is doing something by itself (the progress bar is going in the top right corner, for example), it carries over to the next getKey. Alternatively, a held-down key will register on the first getKey while it is being held down, and the arrow keys and Del will continue to register with further getKeys until they are released.

By changing the loop around a getKey, only a certain key can be accepted.

:Repeat K=105
:getKey→K
:End

This will ignore all key presses until 105 (ENTER) is pressed. In this case, it is probably better to use Pause. But in general, getKey is a very useful tool for accepting a wide range of user input.

<< More on the Home Screen Table of Contents Movement >>

Getting Additional Help

Most of the members of this wiki can be found on the forum, so you can post there with questions and get help with whatever you are working on or trying to learn.

In order to post on the forum, however, you need to create an account. This is an easy process, and should take no more than a couple minutes.

It is the goal of this site to eventually cover all information on TI-Basic programming for the TI-83 series of calculators. However, an excess of information can be overwhelming, so this page gives a suggested reading order (as well as necessary tidbits) so you don't get lost.

There are two alternatives for those who have just ventured into programming for these calculators. While you might want to just jump in, we have a tutorial that explains the basics of TI-Basic and another that answers basic TI-Basic questions.

The first, the TI-Basic Starter Kit, teaches TI-Basic without assuming any previous programming experience. In fact, the very first section explains how to create your first program. After reading this tutorial carefully, you should be more than ready to handle the rest of this site.

The second tutorial is the TI-Basic FAQ. As the name suggests, it is an attempt to answer the common TI-Basic questions that people ask. Many of the questions are related to each other, so it is recommended that you read through the whole list. If you have any questions that aren't mentioned on the list, or an answer doesn't help, please leave a post in the forums and somebody will try to help you.

Further Reading

At this point, you should be familiar with more than a few TI-Basic commands. It might be a good idea to just jump into the command index and click on commands that sound interesting — you can really improve your TI-Basic knowledge that way. Or, select a category from the Commands menu in the top navigation, and read about commands in a more general way.

Looking at code examples is also a good way to learn. Games and Programs are a good place to find such example code. See the Routines page for several short routines to get simple things done in the best possible way.

Use the glossary whenever you come across a term you're not familiar with. If it's not there or the entry doesn't help, drop a note in the forums and (usually within a day) helpful people will explain it and hopefully improve the glossary as well, so no one else has the same trouble.

The pages in the Reference section of the top menu are probably not ones you'd read for fun. Take a look at them at any time to see what they're all about, and then check back when you need to know more.

Writing a Program

Of course, the best way to learn these topics is to come up with a project of yourself (check the project-ideas page if you have no ideas), and go through the steps as you're doing it:

  1. Look at Planning when you're thinking about how to approach the problem.
  2. Consider Commenting Code and Code Conventions when you're writing it.
  3. If bugs arise (and they most likely will), see the section on Debugging.
  4. When the program works, add Setup and Cleanup to it, and check the sections on Usability and Portability.
  5. If the program is too slow (and maybe even when it's not), see Optimization and Code Timings for ways to improve it.
  6. Finally, see Releasing Your Program for how to earn TI-Basic programming fame by making the program public.

These are listed in the Design section of the side navigation menu.

Advanced Topics

The Techniques section in the side navigation menu discusses some advanced issues in TI-83 programming. You should probably have a good grasp of programming before venturing into these pages, but they are worth reading. Give them a glance to see how much you can understand.

Each technique is mostly a stand-alone page. Here are the relative difficulties of the pages:

Easy

  • Friendly Windows — makes using the graph screen commands much easier.
  • Piecewise Expressions — very important to programmers.
  • Saving Games — almost as easy as just storing to a variable.
  • Highscores — an extension of saving, using a string for names and a list for scores.
  • Animation — adds some visual pop or pizazz to your programs.

Intermediate

  • Validation — how to ensure user input satisfies your requirements.
  • Making Maps — how you store the contents of the screen to a variable.
  • Movement in Maps — adds user interaction to programs.
  • Custom Text Input — useful when you want to get input on the graph screen.
  • Custom Menus — allows the user to choose among different options.

Hard

  • Graphics — different ways to make graphics and sprites.
  • Compression — if you wanted, you could get into some heavy theory with this.
  • Self-Modifying Code — code that changes itself while it is executing.
  • Subprograms — calling one program from another, including external and internal programs.
  • Assembly — you can make much better programs, but they are larger and more complicated.

Review

  1. What are the advantages of TI-Basic compared to assembly?
  2. Where do you edit programs on the calculator?
  3. What characters are allowed for a program name?
  4. How do you get an ERR:BREAK error?
  5. How do you get the letter variables A through Z?
  6. How do you store a value to a variable?
  7. Describe what input and output are, and give an example of each.
  8. What is the value of this conditional — A/B and C≥D — when A=52, B=3, C=0, and D=2?
  9. How many options are allowed in a Menu( command?
  10. Describe how a For( loop works, and give an example.

Programming

  1. Write a program that displays your name and age centered on the screen, underneath one another.
  2. Modify the STATES program below by adding a couple more options for U.S. states.
  3. Write a program that computes the sum of the first N positive integers, for a user-supplied value of N.
  4. Modify the NUMBERS program below to only display odd numbers.
PROGRAM:STATES
:Menu("U.S. STATES","FL",FL,"NY",NY)
:Lbl FL
:Disp "FL"
:Stop
:Lbl NY
:Disp "NY"
PROGRAM:NUMBERS
:For(X,-20,20)
:Disp X
:For(Y,1,20)
:End
:End
<< Chapter Summary Table of Contents Sample Program: Guessing Game >>
  1. TI-Basic is the built-in programming language on all of TI's graphing calculators.
  2. When making programs, there is a general order that you follow: you create the program, then you edit the program, and finally you execute the program.
  3. A variable is a place where a data can be stored globally. Each of the letters A through Z (as well as the θ symbol, which is Greek and pronounced "theta") is a variable that can hold a number.
  4. Input happens when a program lets the person running it press a key or type something in, so that it can do something with that. Output happens when a program displays results on the screen.
  5. Control structures are instructions that explain which steps the calculator should follow, and in which order.
  6. The Goto command tells the calculator to jump to another point (more specifically, a corresponding Lbl) in the program, and continue running it from there.
  7. Loops are a type of control structure used to repeat a block of code several times. There are two kinds of loops: a loop that repeats until a condition is satisfied and a loop that repeats a fixed number of times.

Commands Introduced

<< Loops Table of Contents Chapter Exercises >>

This is the end of the first part of the tutorial! To review, here is a sample program that includes the ideas you've learned about in the previous few pages: the traditional guessing game. It will ask you to guess a number between 1 and 1000 in 10 guesses; every time you guess, it will tell you if the number is lower or higher.

The Program

:ClrHome
:randInt(1,1000)→N
:Disp "Guess a number"
:For(I,1,10)
:Input "Guess?",G
:If N=G:Then
:Disp "You've got it!","Guesses:",I
:Pause
:Stop
:Else
:If N>G:Then
:Disp "Higher..."
:Else
:Disp "Lower..."
:End
:End
:End
:Disp "You lose!","The number was:",N

An Explanation

:ClrHome
:randInt(1,1000)→N
:Disp "Guess a number"

The program starts off with a bit of a curve ball: two commands, ClrHome and randInt(, that we haven't really covered yet. ClrHome clears the home screen, and randInt( gives a random number. These will be covered later on, in the second part of this tutorial, so don't worry if you don't quite understand them. In any case, the command randInt(1,1000)→N makes N a random number between 1 and 1000.

Finally, we display "Guess a number" to start off the game.

:For(I,1,10)
:Input "Guess?",G
    ...
:End

To give the player 10 guesses, we use a For( loop that goes from 1 to 10. The variable I is the number of the guess we're on.

The Input command simply asks for a guess, and stores it to G. Remember that N is the number the player's trying to guess.

:If N=G:Then
  :Disp "You've got it!","Guesses:",I
  :Pause
  :Stop
:Else
  :If N>G:Then
    :Disp "Higher..."
  :Else
    :Disp "Lower..."
  :End
:End

This is the most complicated part of the code. To make the nesting of the If commands clearer, it's been indented above, although it wouldn't be on a calculator.

The first check is if N=G: if the guess is correct. If it is, we go to the Then part of the first If. Here we display "You've got it!", and how many guesses it took. We pause the program with Pause, so that the user can read the info we'll provide. Then with the Stop command, we exit the program.

If the guess wasn't correct, we go to the Else part of the first If. Now we need to display a hint - higher or lower. This is accomplished by the second If statement. If N>G, it goes to the Then part, and displays "Higher…" Otherwise, it goes to the Else part, and displays "Lower…" There is no Stop here, so the program continues from there, and does the next cycle of the loop.

:Disp "You lose!","The number was:",N

I'm sure that this code is easy to understand — but why it's here might not be. Think about it, though: this code is right after the End of the For( loop. The For( loop repeated 10 times (once for each guess) without getting here — once it does, that means that 10 guesses have passed; and the player still hasn't guessed the number, or otherwise the program would have stopped.

So once we're here, the player has lost the game. The thing to do now is to display the appropriate message, along with telling him what the right number was.

<< Chapter Exercises Table of Contents More on the Home Screen >>

Loops are a type of control structure used to repeat a block of code several times. Typically, there are two kinds of loops in programs:

  • A loop that repeats until a condition is satisfied
  • A loop that repeats a fixed number of times

In TI-Basic, the first kind of loop is created with the While and Repeat commands, and the second kind is created with the For( command.

While and Repeat

The syntax for these two loops is identical:

:While (condition)
:
    ...
:
:End
:Repeat (condition)
:
    ...
:
:End

In practice, however, they are different. The code inside a While loop will keep repeating as long as the condition is true ("do this while the condition is true"), and exit as soon as the condition is false. The code inside a Repeat loop will keep repeating until the condition becomes true ("Repeat this until the condition is true"). So a loop with While will have the opposite condition of the same loop with Repeat.

There is another subtle difference. The While and For( loops are pre-test loops, which means the condition is checked before you enter the loop. If the condition is false, the loop is skipped entirely. However, the Repeat loop is a post-test loop as the loop is done at least once no matter what. The condition is only checked after a cycle is completed.

The For( Loop

The For( loop is probably the most complicated command we've covered so far. Its syntax:

:For(variable,start,end,step
:
:End

This loop will be repeated once for every value of variable between start and end, increasing it by step each time. For example, For(A,1,10,2) will be repeated once with A=1, then with A=3, then with A=5, then with A=7, and then with A=9 (then the loop stops, because the next value — 11 — is greater than the end value of 10).

By default, the step size is 1, so you don't have to include the step if you want it to be 1. For example, this loop will display the numbers 1 through 10, in order:

:For(A,1,10)
:Disp A
:End

You can also have a negative step size: in that case, the ending value should be less than the starting value, and the value of the variable will decrease each time. For example, this loop will display the same numbers 1 through 10, but in reverse order:

:For(A,10,1,-1)
:Disp A
:End

Some Common Loops

Input validation

Asking repeatedly is not the only way to make sure that input is valid; you might also exit the program if the input is bad, or find a way to interpret bad input as good.

These methods are discussed in more depth in the Validation tutorial.

One way to use a Repeat loop is to make sure that input is valid. For example:

:Repeat X>0
:Disp "ENTER A POSITIVE"
:Input "NUMBER:",X
:End

This program will ask for a positive number in X. After that, the condition "X>0" will be checked — if X wasn't positive, the condition will be false, and the loop will be repeated. So the program will keep asking for a positive number until a positive number is actually entered. This might be useful if your program will not work with negative numbers.

The simplest kind of Repeat or While loop is the infinite loop. This can be done by making Repeat's condition be 0 (false), or While's condition be 1 (true). In either case, the loop will keep going forever.

Finally, For( loops have an unusual use to create delays. For example:

:For(X,1,100)
:End

This code doesn't actually do anything, but repeating the loop 100 times takes some time. This could be useful when you want to pause for a certain time (say, a few seconds) on a screen before displaying the next screen.

Later in this tutorial, you'll learn about the rand command, which can be used as an alternative to For( in creating delays.

<< Labels Table of Contents Ans >>

Next up on the "control structure" miniseries, this page will explain the most general such instruction there is: the Goto command. The idea is simple: this instruction tells the calculator to go to another point in the program, and continue running it from there. Combined with the If command we've already mentioned, this is actually enough to define any sort of sequence of steps you like, even if it's not always the simplest way to do so.

Lbl and Goto

Before telling the calculator to go to another point in the program, we need a way to identify that particular point. There could have been several ways to do this: for example, some ways use the line number. But counting lines in a large program would be a pain, and besides, you'd have to change everything if you inserted an extra line. So TI-Basic uses a different approach, the Lbl command.

Using Lbl is simple: just put it (on a line by itself) at a point in the program you might want to jump to later, and add an identifier. The identifiers TI-Basic allows are one or two characters long, and made up of letters and numbers (so Lbl 0, Lbl XY, Lbl A5, and Lbl 99 are all valid labels). When the program is running normally, the calculator will just skip over a label as though it weren't there.

But once you've made the label, you can use a Goto command to jump straight to it. Goto commands work the same as labels: you give it the identifier you want, and it will jump to the label with that identifier. For example, Goto 0 will jump to the line immediately after Lbl 0.

Some Uses

Exiting a program

Exiting earlier programs wasn't a problem. The calculator keeps going forward, so eventually it will get to the end!

With Goto and Lbl, the calculator can jump backward in the program, so there's a danger of an infinite loop, when the program keeps repeating with no way to exit.

An easy way to exit any Basic program is to use the [ON] key. This will display an error message (ERR:BREAK), and the program will finish running.

Another possibility is with Input commands. Whenever you're in those, you can press [2nd][QUIT] to exit a program.

The first really new thing that we can do with Lbl and Goto is looping over and over in a program. For example:

:Lbl 0
:Disp "HA HA HA"
:Goto 0

This will keep displaying "HA HA HA" repeatedly, and never stop. Without a way to jump around the program, we'd need an infinite number of lines to do this!

You'll often want to pair a Goto with an If statement. Apart from infinite loops, there's not a lot of reasons to always make a jump. But paired with the If command, you can make the calculator go to entirely different parts of the program depending on a condition.

This leads us to an important use of Goto: prematurely exiting a program. When you've written a large program, you might want to stop running it in the middle in certain cases. There are two commands — Return and Stop — that do just that, but Goto provides an alternative. Just make a label (for example, Lbl Q) at the end of the program. Then, you can Goto Q at any time to jump to that label, and exit the program from there. This is useful if you want to always do something at the end of the program, such as displaying "GOODBYE!".

More on the Subject

More info on the Lbl and Goto commands can be found at their respective pages here and here.

The Menu( Command

The Menu( command is one of the coolest uses of labels. It's another form of input: instead of asking the user to type in a value, you're asking the user to make a choice from a menu that looks almost exactly like the built-in menus. After displaying this Menu( and waiting for a choice, the Menu( command will jump to a label that depends on this choice.

The syntax for Menu( is somewhat complicated. First comes a string (in quotes) for the title of the menu. The rest of the parameters come in pairs: a string, in quotes, for a choice in the menu, followed by the label for that choice. For example:

:Menu("SAMPLE MENU","OPTION 1",1,"OPTION 2",2
:Lbl 1
:Disp "OPTION 1!"
:Stop
:Lbl 2
:Disp "OPTION 2!"

This sample program displays a menu called "SAMPLE MENU" with two options, "OPTION 1" and "OPTION 2". With either option, it will go to a label that displays the option you chose, and exits the program.

Because of the size of the screen, you're limited to 7 options or less in a Menu( command.
(NOTE: On the TI-84+ CE, you're allowed up to 9 menu options.)

Problems with Labels

Despite the tremendous convenience of labels, there are two large problems with using them.

The first is speed: jumping to a label can be a relatively slow task (for the calculator, at least). This is because the calculator needs to search through the entire program to find the label. It starts at the beginning, and keeps reading the program until it gets to the end. So if the program is large, and the label isn't at the very beginning, this could take a long time.

The second is more complicated to explain. There are several commands that require an End to finish a block: we've seen this with the If-Then-End form of the If command. Whenever the calculator comes across one of these in a program, it has to use some memory to "remember" to look for an End. When it reaches the End, that memory is freed again.

So what happens if you use a Goto or a Menu( to jump out of the block? The calculator will never find the End it's waiting for. So the memory it used up will never get freed (until the program ends altogether). In fact, if you end up doing this a lot, or even worse, if this is done repeatedly in a looping situation, the calculator will be using a large part of its memory just to keep track of these Ends (this is called a memory leak). Even if this doesn't reach the worst possible conclusion, an ERR:MEMORY, it will slow down the program a lot.

These two problems are a motivation for the several commands we'll see in the next lesson, which provide a better way to do loops like the one we used Goto for in this section. In fact, jumping to the end of the program is one of the only reasons to use Goto, ever.

More on the Subject

More info on the Lbl and Goto commands can be found at their respective pages here and here. You can learn more about the Menu( command here.

<< Logic and Conditions Table of Contents Loops >>

Validation is the process of evaluating user input to ensure it satisfies the specified requirements. Most programs just blindly accept any input that the user enters, assuming that it was entered in correctly and that it is valid. This is a dangerous assumption, because there is a great likelihood that somebody at some point will enter in bad input. When that finally happens, the program will crash when it tries to use the input. In order to ensure this doesn't happen, you should validate user input.

When validating user input, there are three main approaches you can take:

  • Stopping the program — This validation approach involves asking the user for input, and then checking to see if it is a bad input value; if it is, you then just stop the program with a Return or Stop. The idea is that there is no point continuing on to the rest of the program, since the input would only cause the program to crash or get messed up when the input finally gets used.
  • Keep asking for input — This validation approach involves placing your validation inside of a Repeat or While loop, and using a variable as a flag to indicate whether the input is valid or not. The idea is that after asking the user for input, you check to make sure it is not a bad input value; if it is, the bad input flag will be set, and input will be asked for again.
  • Make bad input valid — This validation approach involves asking the user for input, and then trying to filter out any bad parts of the input that might be present. You can make the filters as in depth as you want, but because there is almost an infinite number of things that a user can enter in, there is no way to cover everything. Ultimately, it comes down to knowing the user, and what they are likely to enter in.

How to Validate Variables

There are three main variable types that a user will be asked to input values for in a program: reals, lists, and strings. Each of these variables has their own set of standard validation considerations to check for, along with whatever additional considerations you have in your particular program.

Reals

When validating a real variable, the main things to check for are:

  • Is it within the appropriate range?
  • Is it not a complex number (i.e., there is no imaginary i part)?
  • Is it an integer (i.e., no fraction part)?
  • Is it positive (or zero, if appropriate)?

Testing for these four conditions is relatively easy, considering that there are built-in commands that will take care of it for you: relational operators, the imag( command, and the fPart( command. Generally, you should do the complex number check before the other three checks, because an imaginary part in a number can cause problems.

There's another problem that comes up with using Input specifically. If the input is for a real number A, the user might enter a list, which will be stored to ∟A instead. A simple way of fixing this problem is to store an invalid value to A to begin with, which will be dealt with if the user enters a list and doesn't change A. Many times, this is as simple as using DelVar.

For a simple example of validating a real number, imagine asking the user to specify how many rounds of a game they want to play. A For( loop is used as the main game loop, with the number of rounds being the upper boundary. Since the lower boundary is zero, we want the user to input a number greater than zero. In addition, a For( loop does not work with complex numbers, and we do not want to allow a fraction part because the number of rounds is used to calculate the scoring.

Here is what the validation code for our game might look like with each of the three different validation approaches:

:DelVar AClrHome
:Input "ROUNDS: ",A
:If imag(A
:Return
:If A<1 or fPart(A
:Return
:0→A
:Repeat Ans
:ClrHome
:Input "ROUNDS: ",A
:If not(imag(A
:not(A<1 or fPart(A
:End
:DelVar AClrHome
:Input "ROUNDS: ",A
:max(1,iPart(real(A→A

There are a couple things you should note. In the stopping the program code, we used the Return command to stop the program, instead of the Stop command. This is so that the program will work correctly with subprograms and assembly shells. We used the opposite commands in the making bad input valid code: iPart( instead of fPart( and real( instead of imag(. We are also using the max( command to make one the minimum value for the input.

Lists

When validating a list, the main things to check for are:

  • Is the list length within the appropriate range?
  • Does each list element pass the real validation?

Testing for the list length condition and each of the list elements involves using the built-in dim( command. You first check to see that the list length is acceptable, and then use the dim( command as the upper boundary in a For( loop to go over the list elements one at a time. Each element is validated just like a real variable.

For a simple example of validating a list, imagine you have a lottery game and you want the user to specify three numbers. We want the numbers to be between 1-100, as well as not having an imaginary or fraction part. Here is what the validation code for our game might look like with each of the three different validation approaches:

:ClrHome
:Input "NUMBERS: ",L1
:If 3≠dim(L1:Return
:For(I,1,3
:L1(I
:If imag(Ans:Return
:If Ans<1 or Ans>E2 or fPart(Ans
:Return
:End
:Repeat A=3
:ClrHome
:Input "NUMBERS: ",L1
:DelVar A
:For(I,1,3(3=dim(L1
:L1(I
:If not(imag(Ans
:A+not(Ans<1 or Ans>E2 or fPart(Ans→A
:End:End
:ClrHome
:Input "NUMBERS: ",L1
:For(I,1,3-dim(L1
:randInt(1,E2→L1(1+dim(L1
:End
:3→dim(L1
:max(1,min(E2,iPart(real(L1→L1

Like with the example from before, we had to check for the complex number before checking for the number boundaries and fraction part. This is because neither of those commands work with complex numbers; they will actually throw a ERR:DATA TYPE error. Also important is the optimization that we used to move the list dimension check into the For( loop's upper boundary. This allowed us to eliminate a conditional that we would have had to add.

Strings

When validating a string, the main things to check for are:

  • Is the string length within the appropriate range?
  • Does the string only contain the appropriate characters?

Testing for the string length involves using the built-in length( command. This check by itself is not enough, however, because a string treats commands and functions as just one character (i.e., a string of "ABOutput(" is considered to be three characters long). The way you resolve this problem is by making sure the string only contains certain characters. This involves creating a string of acceptable characters, and then checking the user input against it.

For a simple example of validating a string, imagine you have a two-player hangman game and you want the user to enter in an eight letter word, so that the other player can guess it. The only characters that are allowed are the uppercase alphabet (A-Z), and there is no restriction that the word has to actually exist. (Programming in a check for that would involve keeping a dictionary of words, and that could potentially take up a lot of memory.)

Here is what the validation code for our game might look like with each of the three different validation approaches:

:"ABCDEFGHIJKLMNOPQRSTUVWXYZ
:ClrHome
:Input "WORD: ",Str1
:If 8≠length(Str1:Return
:If not(min(seq(inString(Ans,sub(Str1,I,1)),I,1,8
:Return
:"ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str0
:0:Repeat Ans
:ClrHome
:Input "WORD: ",Str1
:If 8=length(Str1
:min(seq(inString(Str0,sub(Str1,I,1)),I,1,8
:End
:"ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str0
:ClrHome
:Input "WORD: ",Str1
:For(I,1,8-length(Str1
:Str1+sub(Str0,randInt(1,26),1→Str1
:End
:For(I,1,8
:If not(inString(Str0,sub(Str1,I,1
:sub(sub(" "+Str1,1,I)+sub(Str0,randInt(1,26),1)+sub(Str1+" ",I+1,9-I),2,8→Str1
:End

When the user inputs a word, we loop through all of the characters in the word and get their positions in our acceptable characters string. If any of the characters weren't in the string, then their position will be zero, and when we take the minimum of all the positions, the smallest will be zero. With the making bad input valid code, we also concatenate how ever many characters we need to make the word eight characters long.

Making Validation More Friendly

There are a couple different ways you can make validation more user-friendly: displaying error messages when there is bad input, and storing input as a string and converting it to the appropriate variable type.

Displaying error messages to the user when they enter bad input helps the user correct their mistake, and provides some direction on what input you are expecting them to enter. An error message does not need to be complicated or long — just enough so that you can get the point across. For example, say a program is a number guessing game, and the user is expected to enter in a number between 1-1000. If they enter 5000, you can display the message "Between 1-1000".

Storing input as a string allows you to accept any input that the user may enter, even if it is messed up, entered in in the wrong format, or inappropriate for the variable that you are storing it to. This way instead of the program crashing when it gets bad input, it can actually handle it and do whatever it needs to to make it work. You then just check to see if the string has the appropriate value(s), and convert it to the desired variable using the expr( command.

The validation for the real variable, for example, did not include a check for whether it is a list or string. This is because you can only really check for those things when you have a string that you can manipulate. If we wanted to add that check, we can search the string for an opening curly brace and commas or any characters besides numbers. If we find those things, we know that the input is bad, and we can reject it and ask for input again.

In the case of the real variable, the other advantage of using a string is that you don't have to worry about whether the calculator is storing the variable to a list. More specifically, if a list is entered for input, the Input and Prompt commands will actually store the input to a list with the same name. This is possible because you don't need to include the character when referring to a user-defined list. (Entering a string would also work, and the string would become associated with the list.)

Besides checking the list for whether it is a real variable or string, you also can check that it is in the appropriate format. When a list is entered, it needs to start with an opening curly brace, and then have each element separated by a comma. Because most users forget to include the opening curly brace, it is very convenient to place that at the beginning of the list yourself, so that the user never even knows about needing it.

You can take that idea even further, and allow a list to be entered in many different ways: with commas and curly brackets, with commas and no brackets, as a list name (L1 through L6), or as a name starting with ∟, or as a name without the ∟. Instead of requiring one of these, the program might very well be programmed to handle all of them. This all comes down to finding alternate ways of making user input valid.

Thoughts to Consider

The amount of validation you put in a program depends on how large and/or complicated the program is. If you have an extremely complex game with all sorts of user input, then it would be appropriate to include validation for some or most of those things. The general guideline is that the amount of validation needed correlates to the size of the game — i.e., a short math routine probably wouldn't need validation.

While discussing validation, it is also important to mention that since the Input and Prompt commands only work on the home screen, you need to write your own custom input routine using the getKey command if you want to get input on the graph screen. If your entire program is already on the graph screen, however, this should not be an issue, because it makes perfect sense to maintain the user's attention on the graph screen.

.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.