Name: The Classroom Author: ibly31 Download: Classroom.8xp Compatibility: Parent page not set File Size: 4 KB 
The game from AddictingGames is here, on the calculator. BETA VERSION 
There are four main operations on the calculator that are used widely in programs. They are the simple addition, subtraction, multiplication, and division. Although these simple operators are used for simple application, they can be very useful when utilized in advanced matters.
Addition
Addition is the first operator. Mostly, the addition operator is used to combine the values of variables or to increase the value of a variable. It can be used as a counter as well. However, the addition operator can also be used to increase values in lists and combine strings. When applied to lists, you can manipulate sprites.
Addition can be used to move sprites. Well, no duh… Think of this. In the previous chapter, you learned of text sprites. They are typically a coordinate and at that coordinate, text is displayed to simulate a sprite. However, addition can be used to move the pixels with a list. This leads to the discussion of Stat Sprites.
A Stat Sprite is a sprite whose individual coordinates are stored into L_{1} and L_{2}. When you turn Stat Plot 1 on, the sprite is automatically displayed onto the graph screen. Addition can move this sprites really easily. When you add a constant to a list, the calculator distributes that value across the entire list. So, instead of adding each individual pixel, you can add the whole list.
:1+L₁
:1+L₂
Subtraction
Subtraction is a powerful tool being the opposite of addition. Although the subtraction operator cannot be used with strings, it can often replace addition. This operator can be used as a countdown. You can also subtract from lists just like adding.
Multiplication
Multiplication determines the product of two numbers. For example:
5*3
15
TICalculators also use implied multiplication for variables by putting them next to each other. This can be handy and simplify math but it means that, unlike most programming languages, only single letters can store a value–Multiple letters are interpreted as each value being multiplied.
4*A is the same as 4A.
3→NUM Returns an error.
NUM is interpreted as N*U*M
Division
Division is the opposite of division. It is shown with a slash (/)
18/9
2
Fractions also use division. If you are in MATHRINT mode on the home screen, it looks like a fraction while otherwise it looks like a bold slash.
<< Introduction to Math  Table of Contents  Numbers Menu >> 
The Text( command is very helpful for graphics on the graph screen. It can be use to make Text Sprites, and to display information that can be more customized than the home screen. To use this, you use the syntax: Text(X Position,Y Position, Variable). The variable can be any data type.
Displaying Text
Let's say you want to tell the user that they're score was 10. you would use this code:
:Text(1,1,"Your Score Was:10")
Since this is on the graph screen, you don't have to worry about a limit as much. The horizontal limit is 94 pixels, and the characters are smaller.
However, games usually have variating scores. You can use this code to display the player's score, A.
:Text(1,1,"Your Score Was:",A)
Larger Text
There is an additional argument ,1, that goes at the beginning of the command. 1 is the difference between 5*3 Graph screen text and 8*5 Home screen text. So lets say your making a title page, and you want it to say "My Home Page" at the top in big letters, and beneath that the information in small letters, you would use this:
:ClrDraw
:Text(1,0,0,"My Home Page")
:Text(10,1,"This is my testing homepage.")
Text Sprites
Note: If you are using a TI84+CSE or TI84+CE, the increased resolution makes working with Text Sprites very challenging. Many of the techniques described in this section may not function properly.
Text sprites are a way of showing a character or piece of background. They are mainly used for puzzle games, that draw the playing field once, like Donut Quest by Mikhail Lavrov.
A text sprite uses Text( in order to display a little icon. Here is the general code.
:For(A,1,7)
:Text(0,A,sub(string,A,1))
:End
The string is a 7 character string with the first five characters representing the object and the last two being spaces. What happens is every time the For( loop is executed, the text moves one to the right and the next character in the string is displayed. It ends up overwriting the previous text except for its first row. If you don't understand this yet, you may want to throw a Pause in the code to see the sprites drawn step by step.
:For(A,1,7)
:Text(0,A,sub(string,A,1))
:Pause
:End
So, let's say you want to draw a donut. What would the string be? First, draw a five by five grid and outlay your donut.
0 1 1 1 0
1 1 1 1 1
1 1 0 1 1
1 1 1 1 1
0 1 1 1 0
Now, take notice on where the ones are. Look at the first column. The middle three pixels are on. What character has its first row in the same pattern? Let's try (.
0 1 0
1 0 0
1 0 0
1 0 0
0 1 0
Look! Same first rows! So, a ( would be the first character. For the donut, you want the string to be "( [ X [ ( _ _". When this is put into the code, you make a donut shape. This can be done with most five by five designs.
Try making this one.
0 0 1 0 0
0 1 1 1 0
1 1 0 1 1
0 1 1 1 0
0 0 1 0 0
Can you make the appropriate string?
<< Drawing More Shapes  Table of Contents  Using Pictures >> 
Now that you know how to utilize both the graph screen and the home screen, the next step to making wonderful programs is learning how to use the math. That's right: math. Most programs have to use math in order to run. Games that include gravity are an example. The math functions are pretty straightforward; however, their effective use requires some masterful skill. Understanding the math functions will bring you one step closer to becoming a master programmer!
Table of Contents

Basic Operators
The simplest operators include +,, *, /. This tutorial will show how these simple arithmetic operators can be very powerful when applied effectively.
Powers and Exponentials
This group includes all the commands that deal with exponentiation, like ^, 10^(, EE, and e^(. This also includes the inverses such as √, ³√(, ×√, and log( and ln(. These commands have a plethora of applications, one of them being the emulation of gravity.
Probability
This includes the commands of the random numbers as well as nPr, nCr, and !. These can be used to determine outcomes and allow for computer intelligence.
Trigonometry
These are some of the most powerful functions, including sin(, cos(, tan(, and their inverses. If these functions are used in the correct way, then you can create angles and simulate bouncing off of walls, off curved surfaces, and off angled surfaces. These functions can also be used to calculate physics solutions to the transfer of momentum, friction, and rates.
Complex Numbers
This is probably one of the hardest types of math to use. Complex numbers have both a real and an imaginary (i) part, where i=√(1). Using these is challenging, but also very useful. You can use imaginary operations to find coordinate locations and store other parts of information.
This chapter will discuss the advanced uses of these math functions. You should already know how to use some of the above to perform various calculations, but the content of this chapter will be about how the operations can be used to perform calculations beyond what you can imagine. Another thing to consider is the use of these functions. Programs don't have to be all games, but you can create a various amount math routines.
<< Sample Program:Pong  Table of Contents  Operators >> 
Nov  16 —  graphmastur does not match any existing user name just added the invisible include. Just use the "text" to supply the text to make invisible 
{$text}
Optimizing logic is more of a speed issue than a size issue. Logic takes time for the calculator to interpret and thus requires optimization to be fast.
Because the calculator treats every nonzero value as true and zero as false, you don't need a comparison if a variable's value is nonzero. Instead, you can just put the variable by itself.
:If C≠0
can be
:If C
Instead of comparing a variable to zero, use the not( logical operator. Because not( returns the opposite value of the variable, true will become false and false will become true.
:While A=0
can be
:While not(A
When making expressions that combine the and and or operators where the and operator comes first, you don't need to include parentheses around the and operator. The and operator has a higher precedence than or, so it is evaluated first. This can become complicated with complex expressions, so you might want to leave some of the parentheses for clarity.
:If (A=1 and B=2) or (A=2 and B=1)
can be
:If A=1 and B=2 or A=2 and B=1
If you are comparing two unary expressions (expressions with no comparison operator) with the and operator, you don't need the and operator. For and to be true, both values must be nonzero. So, multiplying them will produce the same effect because if either one of the values is zero, the product of both values will also be zero.
:If A and B
can be
:If AB
A similar technique can be applied to expressions with comparison operators, except some restrictions are required.
With unary expressions, to test if A and B is true you multiply them. With equations, you can multiply the left sides of each together and you can do the same for the right sides. However, a value being 0 could return a different result than anticipated, so it is best to use this technique when the values are not 0. Also, this technique does not work when there are multiple values of A and C that multiply to get B times D. For instance, if A equals four, C equals 12, B equals six, and D equals eight, then this optimization will not work because A and B are not equal but A*C equals B*D.
:If A=B and C=D
can sometimes be
:If AC=BD
As and is similar to multiplying, the or operator is similar to addition. Adding two values together yields a nonzero result if one of the conditions is true. When you are comparing equations using the or operator, you can add the two together (This is usually not used for unary expressions because the plus and or symbols are both onebyte tokens). For this, the only restriction is that all values must have the same sign (or be 0), or you can circumvent this by using abs(. This is necessary because if two variables have the same value except one is negative, this expression could return false.
:If A=B or C=D
can sometimes be
:If A+C=B+D
The most unused logical operator is xor (exclusive or). The xor operator is useful when comparing two expressions and checking if one but not both are true. In fact, xor is specifically designed for this purpose.
:If A=2 and B≠2 or A≠2 and B=2
can be
:If A=2 xor B=2
Many times a compound expression can be shortened by combining expressions that have the same meaning or replacing expressions that can be written another way. Think about what the expression means and then think about how to make a shorter equivalent expression. There are many ways of writing an expression, so there are usually ways to rewrite it.
:If A>B or A<B
can be
:If A≠B
If you have the not( operator around an expression, you can usually change the logical operator to the math opposite. This allows you to remove the not( operator.
:If not(B=C and A=D
can be
:If B≠C or A≠D
DeMorgan's Law can be used for expressions in which the not( operator is around two separate unary expressions joined by the and or or operators. It allows you to remove the second not( operator and then change the and to or and vice versa.
:If not(A) and not(B
can be
:If not(A or B
Min( is useful when you are comparing one variable or value to several other variables to see if they are all equal to the variable or value. To use min you just create an expression with the min function and put the common variable or value inside it followed by an equal sign and a left curly brace. You then list out the variables that you are comparing the variable or value to, separating each one with a comma.
:If A=10 and B=10 and C=10
can be
:If min(10={A,B,C
Max( is useful when you are comparing one variable or value to several other variables to see if at least one is equal to the variable or value. You do the same thing as the min function, just replacing min with max.
:If A=10 or B=10 or C=10
can be
:If max(10={A,B,C
You can put a comparison operator inside the min or max functions to compare when several values or variables are equal to one variable and several values or variables are equal to another variable. This works especially well with three or more variables.
:If A=X and B=U or A=Y and B=V
can be
:If max(A={X,Y} and B={U,V
Abs( is useful when you are comparing a variable to two even or odd values using the or operator. You subtract the smaller value from the larger value, divide the result by two, and then put it on the left side of the equal sign. Next, you subtract the number on the left of the equal sign from the larger value, and then subtract that from the variable being tested inside the abs( command. Lastly, you place the resulting equation on the right of the equal sign.
In other words:
:If A=45 or A=105
can be
:If 30=abs(A75
X=n1 or X=n2 should become abs(n1mean({n1,n2}))=abs(Xmean({n1,n2})) (simplified) if n1 and n2 are positive integers and n1+n2 is even. If there are three terms, then see if you can simplify two of them according to this rule. If you can't, then a string of or's will be faster than the max(X={n1,n2,… approach. If there are four terms or more, then use max().
<< Math Operations  Table of Contents  Conditionals >> 
Nov  12 —  The Creating Games section of the Starter Kit is now complete! 
You should now know how to make some basic functional games. As a review for this chapter, here is a sample game that includes most of the things you have learned. The game is called Chase the Star. The goal of this game is to chase a randomly moving star until you catch it. The only trick is, the star doesn't erase its previous position making it a little more concealed.
The Program
:ClrHome
:2→A:2→B
:7→C:15→D
:Repeat (A=C and B=Ans) or K=21
:getKey→K
:If Ans
:Output(A,B,"_")
:A+sum(ΔList(Ans={25,34}))
:Ans8(Ans=9)+8(not(Ans))→A
:B+sum(ΔList(K={24,26}))
:Ans16(Ans=17)+16(not(Ans))→B
:C+randInt(1,1)
:Ans8(Ans=9)+8(not(Ans))→C
:D+randInt(1,1)
:Ans16(Ans=17)+16(not(Ans))→D
:Output(A,B,"X")
:Output(C,D,"*")
:End
:Pause "You_"+sub("Win!Lose",4(K=21)+1,4)
:ClrHome:"_"
An Explanation
:ClrHome
:2→A:2→B
:7→C:15→D
The first step is to set up the game. We use ClrHome to clear the home screen. The next thing we do is initialize the position of each object: the X and the *. The X, (A,B), starts at coordinate (2,2). The star, (C,D), starts at coordinate (7,15).
:Repeat (A=C and B=Ans) or K=21
:getKey→K
:If Ans
:Output(A,B,"_")
Now, we begin the game. Since this is an action game, a Repeat loop will be used. The game will end whenever the X coordinates and * coordinates match or the 2nd button is pressed. Next, the game will ask for input using getKey. This way, the program can recognize key presses to support movement. The next part checks to see if the user pressed anything. If the Ans is not 0 (the user pressed something), the X will be erased. That way, the program can redefine the X coordinates and then redraw X accordingly later on.
:A+sum(ΔList(Ans={25,34}))
:Ans8(Ans=9)+8(not(Ans))→A
:B+sum(ΔList(K={24,26}))
:Ans16(Ans=17)+16(not(Ans))→B
Here is a bit of a new code. This isn't the normal code that you would see in movement. The reason is this time, when the player moves off the screen, we want the X to be redrawn on the other side. To do this, we first find out what direction the user moved. This can be done with the normal code without min( and max(. Next, we will redefine A. If the Ans, which is the projected A, is 9, that means it is past the boundary. So, we subtract 8 to make it 1. If it is 0 (notice we used not(), then we add 8 to make it 8. The same is done with the B variable. The only difference is that since the far boundary for B is 16, we need to add or subtract that to make B normal.
:C+randInt(1,1)
:Ans8(Ans=9)+8(not(Ans))→C
:D+randInt(1,1)
:Ans16(Ans=17)+16(not(Ans))→D
The * does something very similar. Since its movement is random, we use randInt(. The 1 and 1 tells whether to move up or down. The next part is completely identical to the previous coding in order to make the * wrap to the other side.
Note that sometimes the * won't move at all. Since randInt( will select a number from 1 to 1, 0 is sometimes selected.
:Output(A,B,"X")
:Output(C,D,"*")
:End
The final part of the loop is the output. The X is redrawn at its new coordinates and the * is redrawn at its new coordinates. Note that the * doesn't erase its path! This is done intentionally for the game experience, but for other games, erasing the old copy might be an important step.
:Pause "You_"+sub("Win!Lose",4(K=21)+1,4)
:ClrHome:"_"
This is the final part of the program. What happens is the calculator uses the sub( command to determine whether to display "Win!" or "Lose". If the user pressed 2nd, then the program will display "Lose". If the user did not press second (meaning that the user must have caught the star), then the "Win!" message will be displayed. Then lastly, the program will reset the home screen as if nothing ever happened.
This concludes the chapter on making games. However, your journey is not yet complete. The next step is figuring out how to use the graph scene to make superior graphics. Have fun, and prepare to learn how to create some hardcore designs!
<< Exercises  Table of Contents  Introduction to the Graphscreen >> 
Review
 What command will automatically unarchive a list and create it if it doesn't exist?
 What data type would you use to save a highscore?
 What is the seed and what is it useful for?
 What type of loop is appropriate to use for a game like Yahtzee?
 What is the code for movement?
 How can you modify the movement code in order to make it so that when you go off the screen, you loop to the other side?
 Can you use the sub( command to find the element in a matrix?
 Make a formula using rand as the only random command to yield the same results as randBin( with a given seed of 0.
 What happens when you take the inverse of a matrix with determinant 0?
Programming
Modify the following movement code that is supposed to move two objects simultaneously according to user input.
:1→A
:1→B
:4→C
:4→D
:Repeat K=21
:getKey→K
:If Ans
: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,B,"X")
:End
Explain the usage for this code.
:rand→A
:A→rand
Create a game where the player must make it through a maze when the arrow key movements are jumbled up.
<< Summary  Table of Contents  Sample Program: Chase the Star >> 
Here is a basic summary of what you have learned from this chapter.
 The home screen has more than one form of output.
 The getKey command can be used to recognize a key press.
 Movement can be accomplished through the teamwork of getKey and ΔList(.
 Games use skeleton loop to accomplish its main functions.
 There are three special data types, matrices, lists, and strings, that can be used for special purposes, like map underlying, saving, and storing phrases.
 You can use random numbers to enhance game play.
Commands Introduced
 Output(
 getKey
 min(,max(,sum(,ΔList(
 variance(
 fPart(
 DelVar,Archive,Unarchive
 dim(
 SetUpEditor,∟
 sub(,expr(
 rand,randInt(,randBin(,randM(,randNorm(
 not(
<< Random Numbers  Table of Contents  Exercises >> 
Nov  11 —  James Kanjo upgraded the date structure of the news and members sections of the site. Now the date format can easily be modified via the date include page! 
Apr  02 —  DarkerLine and James Kanjo worked together to upgrade the implemented "include template" sections of the site. Result: Site automatically retrieves the required parts of the "Did You Know" and "Featured Article" sections for the 83 68k home pages. 
{$month}  {$day} —  {$description} 
author: 'MasterDonut09(Tanner Hollis)'
description: 'Battle against the computer with lasers across a field. Aim right against the unpredictable AI, or you might just get fried…'
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: Battle.zip
size: '579'
unit: '1'
Optimizing math operations is a great way to make your programs more understandable and faster.
Simple Things
When optimizing any code in TIBasic, you should check to see if your math is done efficiently. For instance, think of a situation where you need to multiply A by 7 and B by 4 and then multiply A and B. Remembering that multiplication doesn't care about order, wouldn't it be easier to just multiply 28 by A and multiply that by B? Here is is how that would look.
:7*A*4*B
works better as
:28*A*B
Now, remember that when you multiply variables with numbers on a calculator, it implies the multiplication. The same is true when multiplying variables together, but you have to do the multiplication yourself between two real numbers. This is what the previous code would look like with implied multiplication.
:28AB
As stated before, an important part of optimization is combining real numbers in your code.. Whenever you see two lone real numbers, combine them. For instance, don't ever write a program with A+1+3+5 in it. Write A+9, and save us some space.
Also, when you have an equation like 9*(X+3), it is better to distribute the nine than to leave the equation factored, because it saves the calculator a multiplication step which helps speed and size. This is something that should be done as a speed optimization when 9 is replaced with a one, two, or three digit number, and as a size optimization when 9 is replaced with a one or two digit number.
Another simple optimization trick is instead of multiplying by, say, 1000, just use E3 (the 'E' when [2nd][,] is pressed) Or use 10^x token under [2nd][LOG].
Complex Math Optimizing
Remember Polynomials? I know you do. Imagine the polynomial p(X)=(X+1)(2X+3), which takes 11 characters to write. I know you're wondering "why on earth are we talking about polynomials? I hate those!" But optimizing them when used is an important step. Notice that when expanded, p(X)=2X^{2}+5X+3 is only 8 bytes, instead of 11. Because expanding a polynomial removes the implied multiplictation necessary for the calculator to do previously, it not only is better sizewise but improves the speed of your program.
<< Optimizing Variables  Table of Contents  Logic Operations >> 
The Graph Screen is 95 pixels wide and 63 pixels high. As can be seen from the Draw Menu there are a variety of ways to display graphics. Manipulating points and pixels is one of the simplest yet most effective ways to get all you can out of the Graph Screen.
Note: Unless otherwise stated the window settings are Xmin=0, Xmax=94, Ymin=62, and Ymax=0.
ClrDraw
The first thing you need to know when you deal with the Graph Screen is how to erase your draw. The function you need is ClrDraw. It's found in the Draw Menu and has no syntax. Simply enter ClrDraw as above and the Graph Screen will erase.
:RecallPic1
:Pause
:ClrDraw
This code will recall Pic1 then wait for the user to press Enter and finally erase all it's content. Now, let's draw !
Pixels
The graph screen is 95 pixels wide and 63 pixels high. Similar to Output( on the Home Screen, the first argument of any Pxl command is the ycoordinate. This starts at 0 from the top (not at 1) and increases as you move down to the bottom row numbered 62. The second argument is the xcoordinate, starting at 0 on the left and increasing to 94 at the right of the screen.
Two advantages using Pxl commands has over Pt commands are the coordinates and speed. The coordinates always range from 094 and 062 so you don't have to worry about the user's window settings. Turning pixels on/off takes almost 2/3 the time it takes their Pt counterparts.
PxlOn(
The PxlOn( command is used to turn a pixel on. It only takes two arguments which are the row and the column. This is useful when you need just a little tweak for the perfect graphic.
Here's an example. Let's say you want to draw a face. You could use Circle( (we'll get to that later) for the head but then you're missing the eyes. Turn a couple pixels on!
:Circle(47,31,4)
:PxlOn(30,46)
:PxlOn(30,48)
PxlOff(
PxlOff( is used to turn a pixel off. It's arguments are the same as PxlOn. This is useful when you need to get rid of a couple little things. For example, if we wanted to add a mouth on our little head we could use PtOn (which is coming right after this) and its special 'mark' argument and then turn off the 2 pixels we don't need.
:PtOn(47,32,3)
:PxlOff(31,47)
:PxlOff(33,47)
PxlChange(
PxlChange( swaps the current state of a pixel. The arguments are identical to those used with PxlOn and PxlOff. A great use for this is in animations where you have something moving through an object. Here is an example. For most shooting games you don't want to interfere with the background, but if you just turn a pixel on then turn it off after it leaves, you could have a big gaping hole where there shouldn't be!The top image uses PxlChange( and the bottom uses PxlOn/PxlOff.
The code for the bullet(s) is
:For(A,46,94)
:PxlChange(16,A)
:PxlChange(16,A1) \\Top part
:PxlOn(36,A)
:PxlOff(36,A1) \\Bottom part
:End
There is very little difference between the code for each but there are major differences between the outputs!.
PxlTest(
pxlTest( checks to see if a pixel is on or off. It's two arguments are the same as the other pixel commands but instead of drawing/undrawing something it returns a 1 if that pixel is on and a 0 if it is off. This is incredibly useful for collision detection. A common example of its use is in a game of snake/nibbles. If the new position of the head was already 'on', then that means it hit something it shouldn't have so they lose.
Points
In contrast with pixels, the coordinates used by Pt commands depend on your current window settings. This could be a problem if you don't want to worry about the user's window settings. It can also be an advantage which allows you to simplify many arguments for drawing commands.
The first argument for Pt commands is the x coordinate and the second is y, the reverse of modifying pixels. Keep in mind that for the ycoordinate it increases as you move upwards just like a normal graph.
The third argument, unique to points, is the 'mark'. The number 1 corresponds to a regular onepixel point. Two is a box with the center missing. Three corresponds to a little '+'.
PtOn(
PtOn( draws the 'mark' at the indicated point. The extra 'mark' argument allows you to make more complicated graphics without drawing them pixelbypixel. Below shows how the different marks can be used for a snake/nibbles game.PtOff(
PtOff( erases the mark at a point. This doesn't just turn off the pixel at the point, but it turns off every pixel that would be part of the mark. An example of using these to get a coollooking point is
:PtOn(20,20,2)
:PtOff(20,20,3)
This will only leave the corner pixels of the little box.
PtChange(
PtChange( switches the state of the point. Unlike the other two point commands there is not 'mark' argument making this essentially PxlChange( except for the coordinates used.
Points and Pixels on TI 84+CSE and TI 84+CE Version Calculators
For those of you who have a TI 84+C version (i.e. one that is capable of displaying color), then the drawing systems are slightly altered. However, the color functionality and higher screen resolution allows for more detailed and colorful graphics!
Note: When working with colors in commands, if no color argument is given, then the pixel or point will automatically be BLUE.
Screen Dimensions
On TI 84+C version calculators, the dimensions of the screen are 165 pixels high and 265 pixels wide. This is a MUCH higher resolution than the monochrome counterparts, allowing for very detailed graphics and sprites. Like other versions, the first pixel (0,0) is in the top left corner and the last pixel (164,264) is in the bottom right.
The PxlOn, PxlOff, and PxlChange commands still work the same, but with the new dimensions. Points are unaffected by the screen change, as they are still dependent on the graph screen.
Working with Colored Pixels
If you have a TI 84+C version calculator, you are probably anxious to use its biggest upgrade: color! Color is only available on the graph screen (unfortunately, color text cannot be displayed on the home screen), and can be used with both pixels and points.
Let's start with pixel commands. To draw a colored pixel, simply add a color name to end of the PxlOn( command, as shown below.
:ClrDraw
:PxlOn(82,132,RED //Draws a red pixel near at the center of the screen
:PxlOff(82,132 //Turns off pixels regardless of pixel color
Notice that the pixel is much smaller than on the grayscale calculators. This allows for more detail, but this also means it takes more commands to draw simpler designs.
You can also call a pixel's color using the color ID, which ranges from 10 to 24. The ID can be stored in a variable, making it very useful for to change colors in a For( loop. The code below will draw a pixel at the (A,B) and loop through all the possible colors in the order they appear in the VARS list.
:ClrDraw
:Lbl 1
:For(X,10,24
:PxlOn(A,B,X
:End
:Goto 1
Note that in the code above you must press [ON] in order to exit. You can change the loop to a Repeat loop with a conditional if you want to use it in a game or other program.
The PxlChange( command can be used in a similar fashion as PxlOn(, changing the pixel from on (color does not matter) to off or from off to a desired color, as shown below. If the pixel is already on, then it will be turned off, even if a color argument is given.
:ClrDraw
:PxlChange(82,132,YELLOW
The PxlTest( command works the same as it does on the monochrome calculators, but there is one catch: PxlTest( cannot be used to test for the color of a pixel, just whether it is on or off. Though this is an annoying handicap, PxlTest( is still just as useful for boundary detection, except now it can detect pixels of any color.
Working with Colored Points
Now let's look at coloring points. Like on monochrome calculators, points are denoted the same way on the graph screen, using (X,Y) coordinates. The points, when drawn, cover more pixels than on grayscale calculators, but are still the same size relative to the graph screen. This makes point commands much more effective when drawing multiple pixels.
The PtOn( command now takes a fourth argument for color to draw. The mark argument, as well as the color argument, are still optional, but can also now be interchanged in order. This means that you can draw a colored point of default mark without having to put an extra "1" to signify a default argument. Here is an example:
:ClrDraw
:PtOn(0,0,1,GREEN
is the same as
:PtOn(0,0,GREEN //The calculator will recognize no mark is given and draw the default point
:PtOff(0,0 //Turns off the point regardless of color
The PtChange( command, like the PxlChange( command, still changes the on or off status of a point, but now takes a color argument when turning points on. The point will still be turned off if it already on, even if a color argument is given:
:ClrDraw
:PtChange(0,0,ORANGE
Just like with monochrome calculators, there is still no mark argument for PtChange(.
<< Introduction to the Graphscreen  Table of Contents  Graph Format Settings >> 
In the starter kit, the link to this page has been relinked to a more thorough, nonstarter kit page concerning variable optimization. This page may be deleted.
<< Displaying Text  Table of Contents  Math Operations >> 
Optimizing text is one of the best ways to optimize your program. It is easy, and it shaves off many bytes.
Table of Contents

Homescreen Specific Optimizations
The following optimizations are only useful for users of the homescreen.
Using Disp Instead of Output(
when you display a short quote at (1,1) on the homescreen, try to use Disp instead of Output. This change does not affect displayed information at all and merely shortens the code a little.
Using Output( to Wrap Text
Because the output command wraps text, Paragraphs are much better displayed on the homescreen using one Output command than using eight or so Disp commands. This optimization can be used to improve size for any display on the homescreen where characters are within seven spaces from each other. Here is an example that would be used as a title screen layout.
:Output(3,2,"ULTIMATE QUEST
:Output(4,3,"DEVELOPED BY
:Output(5,4,"YOUR NAME
is shortened by putting
:Output(3,2,"ULTIMATE QUEST //three spaces// DEVELOPED BY //five spaces// YOUR NAME
this optimization saves an average of three bytes per line.
Graphscreen Optimization
On the graphscreen alone, you can have text and variables displayed on the same line with the same text( command. Separate them with commas. This eliminates the need for the 1+int(log( trick.
:Text(1,1,"HP=
:Text(1,13,H
:4int(log(H
:Text(1,17+Ans,"/
:Text(1,21+Ans,P
can be greatly reduced to
:Text(1,1,"HP=",H,"/",P
Optimizations for Both Screens
The following optimizations can be applied to both the homescreen and the graphscreen to improve size.
The Pause Optional Argument
When you have a list of Disp commands that you pause, you can take the text or variable from the last Disp command and place it after the Pause command as its optional argument, allowing you to remove the last Disp command.
:Disp "A=
:Disp A
:Pause
can be
:Disp "A=
:Pause A
Shortening Conditionals
When you have two or more Disp statements inside an IfThen conditional, you should combine the Disp statements so you can change the IfThen conditional to an If conditional.
:If A>B
:Then
:Disp "A is greater
:Disp "than B
:End
can be
:If A>B
:Disp "A is greater","than B
Shortening Text Length
The first things to do when optimizing text include removing the end parenthesis and quotation marks, as we've already explained. Other things that you can do to optimize include replacing certain words with shorter synonyms and removing embellishing words. Here is an example.
:Output(1,1,"YOU HAVE BEATEN")
:Output(2,1,"THE GAME!")
can be much reduced to
:Output(1,1,"YOU WON!
By removing the excess words and changing beat to won. This optimization saved 27 bytes. Now think of having an unoptimized text adventure, with over one hundred individual text display commands. You could save 2700 bytes just by optimizing the text in that game! Now do you see why optimizing text is so important?
Using sub( to Reduce Size
If someone wins your game, don't you want to tell them that they won with a couple really optimized commands like these? (Pretend that the user has exited the game loop, he has either won or lost, and if A=10 then he won)
:If A=10
:Then
:Output(4,5,"YOU WIN
:Else
:Output(4,5,"YOU LOST
:End
But have you ever thought of using the sub( command to combine the two times the word YOU is displayed? Consider the following code, which is six bytes smaller.
:Output(4,5,"YOU"+sub("WON LOST",1+4(A≠10),4
This code works because in the case that A=10 it should start at 1 at remove four characters and in any other case it should start at 5 and remove four characters.
Deleting repeat phrases
If a word or phrase is repeated, you can reduce size by eliminating it and the display commands, and adding the repeat phrase to a string stored in ans. Note that in this case, it is smaller to use sub( than to do this.
:If A=10
:Then
:Output(4,5,"YOU WIN
:Else
:Output(4,5,"YOU LOSE
:End
can be improved to
:"LOSE
:If A=10
:"WIN
:Output(4,5,"YOU"+Ans
Conclusion
As you have seen, optimizing text is an important thing to do when finishing up your programs, and if you stick to it, your text based programs can be much improved.
<< What is Optimization  Table of Contents  Optimizing Variables >> 
Simply put, optimization is making your game better. It involves reviewing all of your code and looking for subtle changes that can be made, that as a whole, decrease the size of your program and speed it up.
Simple optimizations
There are many ways you can optimize a program. This is a common optimization.
:Output(1,1,A(BC))
can be optimized to
:Output(1,1,AB+C
because subtracting a negative is the same as adding a positive, and because parentheses are not needed at the end of any Output( command or other command where the last token on the line is the parentheses. Another common optimization is quotation marks, which also can be omitted from the end of the Output command. For an example, see the following.
:Output(1,1,"HELLO WORLD")
can be
:Output(1,1,"HELLO WORLD
Complex optimizations
Optimizing isn't always easy. Sometimes, to make programs smaller, one has to scrap previously written code and completely rewrite the program with a different approach. This would be like saying "hey, my program is getting pretty big. I wonder what would happen if I used lists instead of matrices for my saved games?" and then writing the game using lists instead of matrices. This is known as algorithmic optimization, but that's a bit too in depth for a beginner class. If you do wish to know more about it, you can see it here.
Don't be worried. Optimizing is usually a fun process, and as you watch that byte count dwindle, you'll see what we're talking about.
<< Sample Program: Analog Clock  Table of Contents  Displaying Text >> 
Nov  09 —  Program challenge #5 is finally over, now we begin challenge #6, the GUI challenge. 
Nov  09 —  Congratulations to Timothy Foster for winning challenge #5 and entering the Hall of Fame! 
If you remember the old movie, Tron, you might remember the premise of this game. You control a cycle (or in this case, a pixel) that moves in a direction until you change the direction. It leaves a path, and if you hit the path, or the wall, you lose. The trick here is that you must out last your opponent: an AI. This version of Light Cycles for the calculator utilizes a simple AI system that makes it kind of intelligent. Please try to understand the code and learn from it.
The Code
:Full
:FnOff
:AxesOff
:0→Xmin:1→ΔX
:0→Ymin:1→ΔY
:ClrDraw
:Vertical Xmin
:Vertical Xmax
:Horizontal Ymin
:Horizontal Ymax
:60→A:92→B
:2→C:2→D:25→G
:PxlOn(A,B
:PxlOn(C,D
:Text(1,28,31,"READY?
:Pause
:For(E,26,36
:Line(29,E,67,E,0
:End
:Repeat G=45 or not(pxlTest(A,B) and pxlTest(C,D
:getKey
:If Ans
:Ans→G
:A+(G=34)(G=25→A
:B+(G=26)(G=24→B
:1+pxlTest(C+1,D
:Ans+(Ans=2 and pxlTest(C,D1
:Ans+(Ans=3 and pxlTest(C1,D→F
:C+(Ans=1)(Ans=3→C
:D+(F=4)(F=2→D
:PxlChange(A,B
:PxlChange(C,D
:End
This is a tutorial on how to upload files onto the TIBasic Developer. It has been requested that a stepbystep guide be created, as the process can be quite complicated to new contributors.
I am going to create a picture file to be uploaded…
Now I need to save it. Click "File", then "Save As…"
This next step may seem quite obvious. I feel though, that it is necessary to show everybody how to save in a *.PNG format. Click on the "Save as type:" dropdown box, and select "PNG (*.PNG)".
The PNG format is a superior one, as it is a lossless format (retains the full quality of the image), it is compressed (the file size is much smaller than a raw image) and it supports transparency (you can have "seethrough" backgrounds).
I have saved my image on the desktop:
The next step is to open up your favourite webbrowser, and navigate to the page you want to upload your file on. In my case, it's the 83 home page:
Scroll to the bottom of the page, and in the bottomright hand corner is a selection of buttons. If you can't see these buttons, you may not be logged in (log in by pressing the "log in" link at the very topright hand corner of the page). Now click on the "files" button (which conveniently appears in red in this image):
A menu appears just below the buttons. Click on the "upload new file" link, which has also conveniently appeared in red for some reason:
Another menu appears below. Now click the "Choose File" button:
Just navigate to where you saved your file — mine was saved on the desktop. Then click on the file, and click on the "Open" button:
Notice how your file appears in the "File to upload:" text box. When uploading files on the internet, it is always wise to make the filename all one word, and all lowercase. We are going to do that now:
You MUST remember to add the last four characters to the new file name. In this case, we added .png. If you don't it will cause problems later.
Now click on the "upload file" button:
Hooray! Your file is now uploaded to the TIBasic Developer! You will notice the list of files (arranged automatically in alphabetical order) now contains your file. Click on the "info" link:
Now comes up a box, including the URL of the file. The URL is important because it means you can access the file simply by clicking (or typing in) the address.
Name: Quarterback Rating Author: patriotsfan Download: qbrating.zip Compatibility: Parent page not set File Size: 975 bytes 
This program calculates quarterback ratings for four different leagues: NFL, CFL, NCAA, and AFL. 
Name: Boggle Author: patriotsfan Download: Boggle.zip Compatibility: Parent page not set File Size: 2277 bytes 
This game is based on the original Boggle game. It is easy to use, and provides hours of entertainment for avid Boggle players! Definitely worth a download! 
Nov  07 —  A new convention has been added to the Code of Conduct pertaining to the rating of programs. 
Name: Line Judge Author: MasterDonut09 (Tanner Hollis) Download: LINJUDG.zip Compatibility: Parent page not set File Size: 842 Bytes 
The object is to get your line across this maze of dots. Get lucky and you win. You lose, restart! if you are bored, good game, if you are not bored, then its a decent game. 
Now that you have learned about the skeleton of a game, the next part is the meat. A game can only run if variables are used. By now, you should know what a variable is, like A and B and X and so on. However, there are some other specialized variables also available on the calculator. These special data types can be used for superior game design and are used for effect and output. In the next three sections of this chapter, you will learn about these three variable types and their functions.
Storing & Deleting Variables
Variables have values stored in them so that the values can be recalled for later use. When storing an expression containing a variable into another variable, the value of the variable at that time is used. The store (→) command is used for storing variables, and it is accessed by pressing the [STO►] key. When storing a value in a variable, you have the value on the left side of the store command and the variable that it will be stored to on the right side.
:value→variable
When you are done using variables, you can delete them with the DelVar command to save space. This is especially important for lists, matrices, and pictures — since they take up the most space. The DelVar command deletes the contents of a variable from memory. If the DelVar command is used with a real variable, the variable is not only deleted from memory but automatically set to zero the next time it is used. DelVar does not work on specific elements of a list or matrix. In fact, it will actually return an error.
:DelVar variable
Numeric variables
Numeric variables are used for storing numbers. There are 27 numeric variables (from A to Z and θ) that can be easily accessed, and more that the calculator uses for its specific purposes.
Most numeric variables can either be real or complex (the latter involve i, the square root of 1, and are important to advanced algebra). In either case, up to 14 digits of a number can be stored, although only the first 10 will be displayed and used for comparison.
To access a real variable, press ALPHA and then the key corresponding to whatever letter you want your variable to be. You can initialize a real variable by storing a number, another variable, or an expression into the variable using the STO key (or, just using it almost anywhere will initialize it to 0).
List Variables
Lists are used to hold multiple numbers at once, in a specific order. There are six "default" lists named L_{1} through L_{6}, but an important feature of lists is that they can be given names, so that there are millions of possible lists. Lists are important for programmers for many purposes  saving data after a program finishes running, and storing a level of a game are only two of them.
Matrix Variables
Matrices are twodimensional lists (row by column). Equivalent to lists, they are used when the data needs more structure. Matrices are often used for storing a level or a map of the screen. There are only ten matrices available (from [A] to [J]).
String Variables
Strings are used for storing a sequence of characters, that is, text. A common use for strings is to manipulate text to be displayed in a program, but they have many different purposes: highscores, level and map data, and whatever else is desired. Although there are only ten builtin string variables (Str0 through Str9) available to use, strings can hold many different kinds of characters, including letters (both uppercase and lowercase), numbers, functions, and even other commands. The amount of free RAM is the only limit on the number of characters in a string.
Picture Variables and GDBs
Picture variables and GDBs (short for Graph DataBase) are used to save two different elements of the current graph display. A picture variable is used to store the exact appearance of the graph screen. A GDB is used to store system variables relevant to the graph screen  equations, window settings, and the like. 10 builtin variables of each type exist: Pic0 through Pic9 for pictures and GDB0 through GDB9 for GDBs.
(for more information, see Pictures and GDBs)
System Variables
System variables are, for the purposes of this guide, variables that certain commands will use or modify without asking (i.e. without supplying them in the command's arguments). This is a somewhat illdefined category, and in fact the system variables we'll discuss are of a somewhat miscellaneous nature. They include equation and plot variables, window and table parameters, statistical variables, and finance variables.
(for more information, see System Variables)
Converting Between Variable Types
Between lists and matrices
The List►matr( and Matr►list( commands are used to convert between a matrix and several lists. Using these commands, it should be simple to implement any kind of conversion between these two data types.
Between strings and numbers
It is very easy to convert a string version of an expression to a number, list, or matrix: the expr( command can do it — for example, expr("5") will give you the number 5, and expr("{1,2,3}") will give you the list {1 2 3}.
Going the other way, however, is slightly more complicated because there is no builtin command to do it. What you need to use instead are a few small routines: see number to string for how to convert a number to a string. To convert a list or matrix, convert each individual element instead.
Archiving and Unarchiving Variables
On the TI83+/84+/SE calculators, you can archive and unarchive variables. What this entails is the calculator moving the variable to the archive memory or the calculator moving the variable to RAM respectively. The main advantage of archiving a variable is that it is protected from calculator crashes, which clear the calculator's RAM. At the same time, you can't access a variable that's archived; it needs to be in RAM to use it.
:Archive L1
:UnArchive Str1
There are a couple things you need to be aware of when using Archive and UnArchive. First, since the TI83 only has RAM, archiving is not possible, and subsequently neither of these commands are available. This means that you shouldn't use either of these commands if you plan on porting a program to the TI83. Second, archiving does not work with the majority of the system variables, including the graphing, statistical, and finance variables. You can archive the other types of variables, however, although list variables are actually more manageable using the SetUpEditor command.
<< The Game Loop  Table of Contents  Data Types (Lists) >> 
Movement is commonly used in programs as a way to add user interaction. It is part of user input as it relies exclusively upon the getKey command to work. You can use movement in many programs and for many different things, including moving a cursor in a menu or moving a character around the screen. It is the latter case that we are going to explain and show here.
The Code
To achieve the function of movement, we need to use some intense code and combine that with the attribute of getKey. First of all, the object that is being moved must have an identification. In twodimensional space, the object needs two numbers to represent its position: the x coordinate, and the y coordinate. Those can be represented by a couple of real variables, for example, A and B. The next key for movement is to change the object's position. This can be done by adding or subtracting 1 to A or B, which will inevitably change the object's position. The next thing is outputting the result.
Home Screen
On the home screen, movement is quite easy. The xaxis uses numbers 116, and the y axis uses numbers 18. We'll provide a simple description of the code here. First, we must identify the position of the object. Our object is an X, and we want it to be at the center of the screen. So, it needs to be at the coordinates (8,4). However, remember that the position on the home screen is inverted to (y,x), so the actual coordinates are (4,8). We want to store these coordinates. Ok, easy enough…
:4→A
:8→B
Next, we need to make a loop so that the user can move the object multiple times. We will use a Repeat loop so that the code will repeat until the condition is met.
:Repeat K=21
Now, we need to retrieve input from the user. We need to use getKey to identify which arrow key was pressed. So, we will simply install the command and store it into K. Note that we could also use other keys for movement in place of the arrows (like the number pad for using 8 directions), but the arrow keys are simplest here.
:getKey→K
Now, we need to make sure that the user pressed a key. We don't want to erase the object's current position on every loop, so we use a conditional to make sure the key is pressed. Otherwise, the object blinks repeatedly.
:If Ans
The next step is to output the space. If a key is pressed, we need to erase the X so that when we output its new position, the object isn't duplicated. To erase something on the home screen, we simply output a space.
:Output(A,B," ")
The next part is one of the more confusing things we'll be teaching you in this guide, so listen closely. We'll need to look at the code in reverse to analyze it. Here is what it looks like:
:min(8,max(1,A+sum(ΔList(Ans={25,34→A
:min(16,max(1,B+sum(ΔList(K={24,26→B
A quick and dirty explanation. We know K is the value of a keypress. The point is to test which key exactly was pressed. We compare the variable K to a list containing the left and right key values. If left was pressed, the list becomes {1,0}. If right was pressed, the list becomes {0,1}. If neither, {0,0}. Next is the ΔList( command. That command will calculate the difference between the second and first elements in the list. So, if the list was {1,0}, then ΔList({1,0}) becomes {1}. ΔList({0,1}) is {1}, and ΔList({0,0}) is {0}. sum( is used to convert the list into a real number that can be added to B. So, if the input was left, the operation becomes B+(1). Next up are the max( and min( commands. The max( and min( commands are used to create a boundary for the object so that it does not fly off the screen, causing an error in the program. max( compares 1 and the new value of B to make sure it is not too far to the left. If it is, B is reset to 1. The min( command compares the new value of B to 16 to make sure the object doesn't fly off to the right. If it is, B automatically becomes 16. This is done with both A and B, adjusting for the different boundaries and getKey values associated with the horiontal and vertical planes.
Finally, we need to output X at its new position. Simply use the Output( command, and end the loop.
:Output(A,Ans,"X")
:End
(Note!: Ans is used because it is faster than using B. Because we just calculated the value of B, its contents are already stored in Ans!)
Putting all this together, we can now create out program!
PROGRAM:MOVE
:4→A
:8→B
:Repeat K=21
:getKey→K
:If Ans
: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,"X")
:End
That's how movement works! There are a few more things to consider though, and those are discussed below. Remember that you don't need end brackets on the end of a line or in special situations like before the store command. We use them here on the outputs to make it clearer that there is a space in the first one.
For an in depth explanation of the code, you can visit this page.
Simultaneous Movement
Movement is not limited to those two codes. The next step is to add enhancements to make the code work everywhere. For example, what if you have two things moving at the same time? What does that code look like? Unfortunately, the calculator can only output separate objects one at a time. True simultaneous movement is hard to accomplish. However, it can be simulated.
First of all, since you have multiple objects, you need multiple pairs of coordinates. The easiest way would be to use a bunch of real variables, but that isn't always the best way. For a small amount of objects, like from 23, real variables can be used. However, for large amounts of objects, like 410 or even more, a list might be needed because of the limited amount of reals. Now, another thing to consider is speed. The more objects moving, the slower the program will be. Make sure you define what you are wanting before writing a code.
Now, let's say you only want two things moving at a time. You want the calculator to randomly move an X and an O. First, you need to initialize their positions. The X will start at the top left corner and the O will start at the bottom right. Since we are moving only two objects, we can use real variables. A and B will be X, and C and D will be O.
:1→A
:1→B
:8→C
:16→D
The next step is to start the loop. The loop ends when the objects collide or a button is pressed.
:Repeat getKey or (A=C and B=D)
Now, since the two objects are just moving randomly, you don't need to ask for input. Thus, no little getKey command is needed to determine movement. So, the next step is to simply erase the current positions of the objects since we know they are going to move anyway. Just output a space for each coordinate, remembering the form (x,y).
:Output(A,B,"_")
:Output(C,D,"_")
Now, the coordinates have to be redefined to represent movement. Since the movement is random, we will use randInt(. (You will learn random commands later). We can create a variant of the code used for normal movement, but since we don't need to test a getKey, we don't need ΔList( or anything. However, min( and max( are still needed to test the boundaries. So, here is the code.
:min(8,max(1,A+randInt(1,1)))→A
:min(16,max(1,B+randInt(1,1)))→B
:min(8,max(1,C+randInt(1,1)))→C
:min(16,max(1,D+randInt(1,1)))→D
The final part is the output. Simply output each character with the new values.
:Output(A,B,"X")
:Output(C,D,"O")
:End
Putting the code together, we get the following:
PROGRAM:MOVE3
:1→A
:1→B
:8→C
:16→D
:Repeat getKey or (A=C and B=D)
:Output(A,B,"_")
:Output(C,D,"_")
:min(8,max(1,A+randInt(1,1)))→A
:min(16,max(1,B+randInt(1,1)))→B
:min(8,max(1,C+randInt(1,1)))→C
:min(16,max(1,D+randInt(1,1)))→D
:Output(A,B,"X")
:Output(C,D,"O")
:End
So, now you can create movement emulations for user interaction and create calculator generated motion along with simultaneous elements.
Unfortunately, when trying to move 5 or more objects, real variables become a hassle. When you juggle a ton of objects, you must use a list to keep track of all the coordinates and to make a speedy program. You won't need to know this now though, for as you progress with further lessons, you will gradually gain that knowledge.
Collision detection
The next step is pertains to this question: How can I create walls where the object can't go through them? With the previous codes, if you create a random boundary, the object can still go through it. What if you want to make a maze? Well, fortunately, there is a way. To make boundaries, you have to add some sort of conditional testing for if there is a wall there or not. The way you do that is creating an underlying code that describes the board on which an object is located. There are many ways to do this.
Let's create a simple maze where you are guiding an X, and the walls are I's. What we must first do is initialize the maze in one of the data types (which you will learn later). The best way is to use a string; however the easiest way is by matrices. A matrix is a two dimensional array of information. What we need to do is use three numbers: 1 will be a wall, 0 will be a space, and 2 will be the end of the maze. Store the maze into a matrix variable by inputting the whole code.
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,1]
[1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1]
[1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1]
[1,0,0,0,1,0,1,0,0,1,0,1,1,0,0,1]
[1,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1]
[1,1,0,0,0,0,1,1,1,0,0,1,1,0,0,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1]]→[A]
Notice that the dimensions of this code is 8 x 16, the exact dimensions of the home screen! This code will be "under" the home screen so that the calculator can sense a collision when asked to. Of course, you will still need some special code.
Next, you want to initialize the position of the object. We want it near the top left corner, i.e. (2,2).
:2→A
:2→B
Okay, now we need to do a few different things. You cannot jump into the movement phase just yet, because now the map needs to be shown. To display the map, we need to use a couple of For( loops to represent each element. The first represents the row while the second represents the column. The code then needs to use the sub( command to find which character, either I for a wall, a space for a 0, and a W for the winning space. It tests what the matrix element is and outputs that accordingly.
:For(C,1,8)
:For(D,1,16)
:Output(C,D,sub("_IW",[A](C,D)+1,1))
:End
:End
Now we will start the main movement loop. The first thing you need to do is define the loop with Repeat. This time, the conditional needs to test when the player reaches the W, or the matrix number 2. We can then define the loop like this.
:Repeat K=21 or [A](A,B)=2
The next natural step is to ask for input. Use getKey as usual.
:getKey→K
Next, test to see if there was a key press. If there was, clear the object for it to be redrawn later.
:If Ans
:Output(A,B,"_")
Now comes the movement code. It is a little more complicated now that we have to test whether or not the player has collided with a wall. Fortunately, since the surroundings are all walls, we won't need min( or max( to test the limits. We only need the code to test the walls. First, notice that the only way to reach the winning space is by going down. This will help on the code. Let's concentrate on vertical movement. Here is the code:
:sum(ΔList(Ans={25,34}))
:A+Ans([A](A+Ans,B)≠1)→A
Here is what we are doing. First, we need to find out whether we are going up or down. So, we are using the normal code for that. The next part tells us whether there is a wall in that direction or not. Consider the condition [A](A+Ans,B)≠1. This code is testing the square you want to move to. If the square is a winning space or normal space, the condition gives off 1. If the space is a wall, it says 0. Since this is being multiplied by Ans, the direction, the object will not change position if the condition is 0.
So, similarly, we can use that code for the lateral movement. The only difference is the conditional which is not([A](A,B+Ans)). We use not because you cannot reach the winning square with a horizontal key press. Thus, we do not need to test for 2 like before.
:sum(ΔList(K={24,26}))
:B+Ansnot([A](A,B+Ans))→B
Finally, we must output the result and close the loop.
:Output(A,Ans,"X")
:End
When we put all this code together, we get a functional maze program!
PROGRAM:MOVE4
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,1]
[1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1]
[1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1]
[1,0,0,0,1,0,1,0,0,1,0,1,1,0,0,1]
[1,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1]
[1,1,0,0,0,0,1,1,1,0,0,1,1,0,0,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1]]→[A]
:2→A
:2→B
:For(C,1,8)
:For(D,1,16)
:Output(C,D,sub("_IW",[A](C,D)+1,1))
:End
:End
:Repeat K=21 or [A](A,B)=2
:getKey→K
:If Ans
:Output(A,B,"_")
:sum(ΔList(Ans={25,34}))
:A+Ans([A](A+Ans,B)≠1)→A
:sum(ΔList(K={24,26}))
:B+Ansnot([A](A,B+Ans))→B
:Output(A,Ans,"X")
:End
That sums up movement with collision. Remember, depending on the situation of the map, you might have to alter the code. That is the art of programming: it is not always consistent and needs constant intelligence from the programmer.
An Alternate Method
There is another way to display movement. It is faster, but it is also larger. This method is capable of absorbing conditionals very well which makes it a much more lenient code. Instead of using ΔList( and stuff, you can use a simple piecewise expression.
:A(K=25 and A>1)+(K=34 and A<8)→A
:B(K=24 and B>1)+(K=26 and B<16)→B
This code will also move something around the screen.
For collision detection, you could use
:A(K=25 and [A](A1,B)≠1)+(K=34 and not([A](A+1,B))→A
:B(K=24 and not([A](A,B1))+(K=26 and not([A](A,B+1))→B
See how easy it is just to add the extra condition? This code's flexibility makes it very popular, but remember that it should only be used when needed because of its size!
Fullscreen on a TI84+ CSE/CE
The TI84+ CSE and CE models have a bigger screen size than previous models. Whereas the old dimensions were (for (Y,X)) (8,16), the new models are (10,26). The above programs are for the old dimensions, and while they will work on a 84+ CSE/CE, they don't display across the full screen. To change the programs MOVE and MOVE3, all you really have to do is change the Y and X maximums.
PROGRAM:MOVEC
:4→A
:8→B
:Repeat K=21
:getKey→K
:If Ans
:Output(A,B," ")
:min(10,max(1,A+sum(ΔList(Ans={25,34→A
:min(26,max(1,B+sum(ΔList(K={24,26→B
:Output(A,Ans,"X")
:End
PROGRAM:MOVE3C
:1→A
:1→B
:8→C
:16→D
:Repeat getKey or (A=C and B=D)
:Output(A,B,"_")
:Output(C,D,"_")
:min(10,max(1,A+randInt(1,1)))→A
:min(26,max(1,B+randInt(1,1)))→B
:min(10,max(1,C+randInt(1,1)))→C
:min(26,max(1,D+randInt(1,1)))→D
:Output(A,B,"X")
:Output(C,D,"O")
:End
Creating a fullscreen maze is much more difficult, as it involves more than changing a few numbers. As opposed to making an 8x16 matrix, we have to make a 10x26 matrix, which obviously requires more work. Here is the code for a fullscreen maze:
PROGRAM:MOVE4C
:[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
[1,0,0,1,0,1,0,1,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,1]
[1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1]
[1,0,1,0,1,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1,1,1,0,1]
[1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1,1,0,0,1]
[1,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,0,0,1,1,0,1,1,1,0,1]
[1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,1,1,1,1,0,1,1,0,0,1]
[1,0,1,0,1,0,1,0,1,0,1,1,0,0,1,0,1,1,1,0,0,1,1,0,1,1]
[1,0,0,0,1,0,1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,0,0,1]
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1]]→[A]
:2→A
:2→B
:For(C,1,10)
:For(D,1,26)
:Output(C,D,sub("_IW",[A](C,D)+1,1))
:End
:End
:Repeat K=21 or [A](A,B)=2
:getKey→K
:If Ans
:Output(A,B,"_")
:sum(ΔList(Ans={25,34}))
:A+Ans([A](A+Ans,B)≠1)→A
:sum(ΔList(K={24,26}))
:B+Ansnot([A](A,B+Ans))→B
:Output(A,Ans,"X")
:End
Conclusion
Now that you know the core of movement, you now need to learn how to create the skeleton of all games: Loops. As you progress through the lessons, you will find better ways to make maps, emulate movement, and create better games. Have fun!
<< Using getKey  Table of Contents  The Game Loop >> 
author: basickevin
description: 'A fully optimized, release ready full version of pong. Includes the ability to spin the ball and also to select a difficulty level, which speeds up the ball and makes the AI smarter on hard.'
arcade: '1'
graphics: '0'
platform: '0'
puzzle: '0'
rpg: '0'
strategy: '0'
sports: '0'
casino: '0'
board: '0'
utility: '0'
misc: '0'
image: '/archives:spinpong/spinpong.gif'
download: Spin%20Pong.zip
size: '523'
unit: '1'
Finds the remainder of a division between two numbers.
A,M
A,M
TI83/84/+/SE
:AMint(A/M
This program takes modular equations of the form X ≡ A (mod M) and solves them for the common residue, which is equal to the remainder after A has been divided by M. Among other things, it can be useful for finding the day of the week (with Sunday–Saturday matching up with 0–6) after M number of days has passed, or the time on a clock after a number of hours has passed.
For example, if we were on a Saturday (which is day 6, given that Sunday is day 0), and we wanted to figure out what it will be in 18 days, we would store 6+18→A, then 7→M as the appropriate number of days in a week, and finally we would calculate MfPart(A/M to get 3, which translates to a Wednesday.
This simpler version can be used if A is guaranteed to be positive:
:MfPart(A/M
It may fail due to rounding precision errors.
Nov  03 —  thornahawk finished the invT( command. Now all calculator commands documented (again!) 
Calculates the inverse of the cumulative Student's tdistribution function with degrees of freedom ν.
invT(probability, ν)
Press:
 2ND DISTR to access the distribution menu
 4 to select invT(, or use arrows.
TI84+/SE (OS 2.30 or greater)
2 bytes
invT( is the inverse of the cumulative Student t distribution function: given a probability p and a specified degrees of freedom ν, it will return the number x such that tcdf(E99,x,ν) is equal to p
:invT(.95,24
1.710882023
Advanced
invT( is meant for use with socalled "onetailed' tests; for twotailed tests, the proper expression to use (corresponding to the inverse of tcdf(x,x,ν)) is invT(.5(1+p),ν)
Formulas
Unlike the tpdf( and tcdf( commands, the invT( command does not have a closedform formula. However, it can be expressed in terms of the inverse incomplete beta function.
For one degree of freedom, invT( is expressible in terms of simpler functions:
(1)Related Commands
Nov  02 —  Just noticed there is only one command that needs to be completed: invT( 
Name: Minesweeper v3.1 Author: Timothy Foster Download: Minesweeper1.1.zip Compatibility: Parent page not set File Size: 2530 bytes 
This is minesweeper written in pure BASIC, no assembly. It takes advantage of three difficulty levels and a custom dimension setter. It also keeps track of the high score (or low score, rather) for each difficulty. With easy controls and relatively fast loading times, this program is worth trying! Since this is the first release of the program, please help me modify it by either identifying bugs or critiquing various elements. Other ideas for improvement are welcome. 
TIBasic Developer
The TIBasic Information Repository
Oct  30 —  Timothy Foster continues work on the starter kit after many days of no development. 
Sometimes, you need to just separate one thing from another, want some sort of popup window, or want a nice looking frame for the menu on your game. Well, here's some ways on how to do just that.
Making Windows
 Pen
 The Pen tool helps you to make lines that are continuous. Good to use if you don't want to repeatedly use the Line( command
 Line(
 The Line( command allows you to draw straight lines on the graphscreen
 Horizontal and Vertical
 Much like the name says, the Horizontal command draws a horizontal line and the Vertical command draws a vertical line
 Circle
 The Circle( command allows you to draw a circle at a specified point.
 The POINTS commands
 PtOn(, PtOff(, PtChange(, PxlOn(, PxlOff(, and PxlChange( are all commands that allow you to draw points on the graph screen. Make sure you know how the "Pxl" commands work since their coordinates are a little bit more restricted.
Full Screen Windows
When you need to put your game or program in some sort of "frame," then you need to decide what you are going to use it for. If you want to have something that looks very professional, and have it still look simple, here is one way to do that:
If you want a window for a game, say one that is supposed to look medieval, then this might be an appropriate window:
You just have to experiment with what window looks good and what would work with your game/program.
Popup Windows
Pop up windows are a great way to show the user some sort of information. For example, if you have made a game that uses the list "GAME", then you can put a popup menu using RecallPic if the dimensions of the list is 0 (meaning that the user hasn't played your game before).
Setupeditor GAME
If dim(GAME)=0:Then
RecallPic 1 //You can replace "1" with any other picture variable
End
Here is a picture of a popup menu like that:
Game screen
If you want a game screen to show your game statistics like health, money, number of battles, current level, or your character name, then you could use a layout screen for a game. Let's use the medieval screen from above.Recalling Windows
As stated previously, you can call your windows in a program with the RecallPic command. For more information on how to make windows/the graphscreen, you can look at the Advanced Graphics section of the TIBasic Starter Kit (specifically here).
You can create your own window if you want, but these are some suggestions.
The final data type is the string. A string is a form of representing a phrase. Before, you could only use numbers, but a string will hold numbers, letters, and almost every possible character. This proves very useful because strings can serve multifunctions very easily. They can be used as variables, outputs in the form of numbers or words, and converters. Below, we will discuss how to use strings.
Table of Contents

Setting up Strings
There are ten different strings: Str0 to Str9. Unlike lists or matrices, strings do not use the dim( command to determine its length. Also, strings do not have a special SetUpEditor command. So, you need to be careful with archiving or unarchiving strings. Fortunately, beyond that, there are no special set up requirements. All you have to be sure of when dealing with strings is whether it is archived or not and whether the string already has something in it.
Writing Strings
Strings have an infinite dimension as long as it fits in the RAM. Unlike with lists or matrices, strings are not a way to represent numbers and expressions, but it represents phrases, and phrases are dictated with quotations. So, when writing a string, you must precede the phrase with quotations.
:"HELLO, WORLD"→Str1
You can store practically any character into a string, but you cannot store the →. So, let's say you wanted to store a quadratic equation, 2x^{2}+4x+8, into a string. Just precede with quotations and write:
:"2x²+4x+8"→Str1
Using Strings
Strings are used in various ways. The reason strings are so powerful is that they can be used for many different applications, they are small, and they can be made very large if need be. Strings are commonly used as a form of outputting words or numbers in a prettier fashion, but strings can also be used like a variable, and much more efficiently at that.
Output
First off, strings are most commonly used for output. For example, programmers would store bits and pieces of information into a string and then display it at the end to get a final output. For example, look at this code. All it is doing is testing a condition (which phrase to store in the string) and acting upon it.
:If A=3
:Then
:"You WIN!"→Str3
:Else
:"You LOSE."→Str3
:End
:Disp Str3
However, this code seems a little redundant, since all you need to do is simply display the phrase before storing into a string. However, strings have a special little quirk that allows them to be "added" together. What the calculator does is if it finds the addition of two strings, it will combine the strings together into one super phrase, much like what augment( does with lists. With this in mind, we can actually have initial strings and combine things into the strings depending on some conditions to receive an output. So the above code can be turned into this:
:"YOU_"→Str3 //(The _ is a space)
:If A=3
:Then
:Disp Str3+"WIN!"
:Else
:Disp Str3+"LOSE."
:End
This stores "YOU" with a space into Str3. Depending on the condition, the program will combine that string with either WIN! or LOSE.
The sub( command is very useful. It can be used to display YOU WIN or YOU LOSE in a more simple way than previously described. sub( has three arguments, the string to get data out of, the position in that string to start retrieving data, and the length of the string to be extracted. Here is how you would display YOU WIN or YOU LOSE without IfThen statements.
Disp "YOU "+sub("WIN LOSE",1+4(A=3),4
Also, consider this code.
:"_"→Str2
:For(A,1,7)
:A+2(A≥3)(A≤4)2(A≥5)(A≤6)→A
:Str2+sub("AWESOME",A,1)→Str2
:End
:Disp Str2
This code uses strings to unscramble AWESOME. Don't fret…it may look complicated, but it isn't all that hard. We are using a For( loop to run through each letter. The next line changes A to the appropriate position in the messedup string. The sub( command then finds the letter indicated by A and stores it into Str2 along with any letter already there. So you see, strings are very powerful!
Variable Usage
Strings can also be used as a variable. There is a very special command called expr( that solves the string as if it was an expression. So, if Str4 was defined as "2+2", then expr(Str4) would be the number 4. However, with this new ability, there comes a new type of usage.
A power like this can be used as a variating variable. In other words, you can set the string value to change when other real variables change using expr(. Consider this code.
:"A+B"→Str1
:5→A:4→B
:Disp expr(Str1)
:A+0.5B→B
:Disp expr(Str1)
:Disp Str1
This code gives an output of 9, 11, and A+B. The whole time, the string remained the same, but when A or B changed, so did expr(Str1). This is an advanced technique known as Self Modifying Code, or at least one variation thereof. You won't be needing this for now, but this just shows you exactly how powerful strings can be. There are so many things you can do such as store coordinates and use sub( to take them out. As you can see, this data type has a lot power within the programming language.
Cleaning Up
If you don't want the string, you can simply delete it. If you want to keep it, simply archive it for storage.
Final Notes
That concludes the theory of strings (of course, nothing related to String Theory…) and the end of learning data types. These data types are used widely in BASIC programming, and it is highly recommended you begin practicing with each. As for now, the next lesson delves you into the realm of random numbers, one of the core components of games today.
<< Data Types (matrices)  Table of Contents  Random Numbers >> 
Calculates the linear regression of two sets of data with a confidence interval for the slope coefficient.
LinRegTInt [xlist, ylist, [frequency], [confidence level], [equation]]
Press:
 STAT to access the statistics menu
 RIGHT to access the TESTS submenu
 ALPHA G to select LinRegTInt, or use arrows
TI84+(SE) OS 2.30 or greater
2 bytes
Like LinReg(ax+b) and similar commands, LinRegTInt finds the best fit line through a set of points. However, LinRegTInt adds another method of checking the quality of the fit, by calculating a t confidence interval for the slope b. If the confidence interval calculated contains zero, the data supplied is insufficient to conclude a linear relation between the variables.
To use LinRegTInt, you must first store the points to two lists: one of the xcoordinates and one of the ycoordinates, ordered so that the nth element of one list matches up with the nth element of the other list. L₁ and L₂ are the default lists to use, and the List Editor (STAT > Edit…) is a useful window for entering the points. You do not have to do the regression on L₁ and L₂, but if you don't you'll have to enter the names of the lists after the command.
You can attach frequencies to points, for when a point occurs more than once, by supplying an additional argument  the frequency list. This list does not have to contain integer frequencies. If you add a frequency list, you must supply the names of the xlist and ylist as well, even when they are L₁ and L₂.
You can supply a confidence level probability as the fourth argument. It should be a real number between zero and one. If not supplied, the default value is .95. (95% confidence level) If you need to specify a different confidence level, you must enter the names of the lists as well, even if they're L₁ and L₂.
Finally, you can enter an equation variable (such as Y₁) after the command, so that the line of best fit is stored to this equation automatically. This doesn't require you to supply the names of the lists, but if you do, the equation variable must come last.
For example, both
:{4,5,6,7,8→L₁
:{1,2,3,3.5,4.5→L₂
:LinRegTInt
and
:{4,5,6,7,8→X
:{1,2,3,3.5,4.5→Y
:{1,1,1,1,1→FREQ
:LinRegTTest ∟X,∟Y,∟FREQ,.95,Y₁
will give the following output:
LinRegTInt
y=a+bx
(.69088,1.0091)
b=.85
df=3
s=.158113883
a=2.3
r²=.9897260274
r=.9948497512
(the last two lines will only appear if diagnostics have been turned on  see DiagnosticOn)
 The first line shows the confidence interval containing the slope of the fitted line; as mentioned above, if the interval contains 0, it cannot be concluded that the two variables have a linear relationship. Also, the smaller the difference between the two numbers, the more precision that can be attributed to the calculated slope.
 df is the degrees of freedom, equal to the number of points minus two.
 a and b are the parameters of the equation y=a+bx, the regression line we've calculated
 s is the standard error about the line, a measure of the typical size of a residual (the numbers stored in ∟RESID). It is the square root of the sum of squares of the residuals divided by the degrees of freedom. Smaller values indicate that the points tend to be close to the fitted line, while large values indicate scattering.
 r² and r are respectively the coefficients of determination and correlation: a value near 1 or 1 for the former, and near 1 for the latter, indicates a good fit.
Related Commands
Divides one number by another.
value1 / value2
Menu Location
Press the [/] key to paste /.
This command works on all calculators.
1 byte
The / operator divides two numbers, variables, or expressions. It has higher priority than + and , so it will be done before them; it has the same priority as *.
:x/y
x/y
:2/2
1
Though division by zero isn't allowed, it will not cause an error; instead it returns the value undef — short for "undefined." Dividing by a variable that hasn't been defined yet will cancel it if it occurs on both sides: 5*x/x will equal 5; a short warning will be given to the effect that this isn't valid for x=0.
Related Commands
See Also
Returns the multiplication of two numbers.
value1 * value2
Menu Location
Press the [*] key to paste *.
This command works on all calculators.
1 byte
The * operator multiplies two numbers, variables, or expressions. In many cases, it's implied — 5x, for instance, will be assumed to be 5*x. There are two exceptions: long variable names — xy will be interpreted as a single variable, not as x*y — and function calls — f(x) will be interpreted as f() applied to x, not as f*x.
Multiplication has higher priority than + and , so it will be done before them; it has the same priority as /.
:x*y
x*y
:2*2
4
Advanced Uses
Multiplying matrices is not the same as multiplying their individual elements (which the .* operator does). To multiply two matrices, the first must have the same number of columns as the second has rows. The product of an MxN matrix with an NxP matrix will be an MxP matrix, whose (a,b)^{th} entry will be the dot product of the a^{th} row of the first matrix with the b^{th} column of the second.
Error Conditions
240  Dimension mismatch happens when the dimensions of two matrices don't match up for multiplication to work.
Related Commands
See Also
Returns the difference of two numbers.
value1  value2
Menu Location
Press the [] key to paste .
This command works on all calculators.
1 byte
The  operator subtracts two numbers, variables, or expressions. Order of operations dictates that it's calculated after * and /, and at the same time as +.
The  operator can also be used on lists and matrices. For the most part, it behaves in the intuitive way, distributing the operation over each element. However, subtracting a number from a matrix (or a matrix from a number) behaves differently: the number is only subtracted along the main diagonal of the matrix. For "normal" subtraction that applies to every element of the matrix, see ..
:11
0
:5→x
:23x
13
:[1,2;3,4]100
[99 2]
[3 96]
Related Commands
See Also
Returns the sum of two numbers.
value1 + value2
Menu Location
Press the [+] key to paste +.
This command works on all calculators.
1 byte
The + operator adds two numbers, variables, or expressions together. Order of operations dictates that it's calculated after * and /, and at the same time as .
The + operator can also be used on lists and matrices. For the most part, it behaves in the intuitive way, distributing the operation over each element. However, adding a number to a matrix (in either order) behaves differently: the number is only added along the main diagonal of the matrix. For "normal" addition that applies to every element of the matrix, see .+.
:1+1
2
:5→x
:2+3*x
17
:[1,2;3,4]+100
[101 2]
[3 104]
Related Commands
See Also
Oct  26 —  ManualFit command is first created. Only two commands left to go… 
Allows user to create a line of best fit and modify it
ManualFit {Function}
Under Statistics or Catalog
 Press STAT
 Go to CALC
 Press ALPHA D (or scroll to bottom)
TI84+/SE (OS 2.30 or greater)
2 bytes
This command will allow the user to create a line of best fit according to their judgment. Activate the command by just pasting it on the screen. Then, click on a point for the line to begin followed by an end point. The calculator will then draw your line and display its equation at the top left corner of the screen. You can modify it by selecting the equation part and pressing enter. Input your desired value for the calculator to change it. The equation is stored into Y₁. If you specify what equation you want to store it to, then it will store to that function.
:ManualFit
(this activates the command and stores to Y₁
:ManualFit Y₃
(this stores to Y₃ instead)
One note about this is that it only graphs linear models. It is written in the form y=mx+b, and you can modify m or b.
Exit out by 2nd QUIT.
Advanced Uses
This command is able to function in a program, but you cannot modify the values. This is a unique form of gathering user input that stores into the specified Y= function. Of course, this draws a line across the graph screen. You can then convert the function into a different form, like this:
:ManualFit
:Equ▶String(Y₁,Str1
This will turn the equation the user drew into a string which can then be used for output or calculations.
Related Commands
Oct  25 —  Timothy Foster creates polynomial division routine 
Routine Summary
This program will divide two polynomials of any positive integer degree.
Inputs
L_{1} Dividend
L_{2} Divisor
Outputs
L_{3} Quotient coefficients in descending degree
Variables used
L_{1}, L_{2}, L_{3}, A, B, D
Calculator Compatibility
TI83/84/+/SE
Author
Timothy Foster
Download
:DelVar L₃
:For(A,1,dim(L₁)+1dim(L₂
:L₁(A)/L₂(1→L₃(A
:For(B,2,dim(L₂
:L₃(A)L₂(B
:Ans+L₁(A+(B1→L₁(A+(B1
:End
:End
:ClrHome
:For(A,dim(L₁)(dim(L₂)2),dim(L₁
:L₁(A→L₃(1+dim(L₃
:End
:Disp "FIRST TERM
:Output(2,1,"X^
:Output(2,3,dim(L₁)dim(L₂
:Output(3,1,L₃
This routine will solve polynomial division with any given integer degrees. The dimension of L_{1} is the degree+1 of the dividend polynomial, and the dimension of L_{2} is the degree+1 of the divisor. The numbers used in the list are the coefficients of the respective polynomial in descending degree order, including place holder 0's. So, a polynomial of 3x^{3}+2x^{2}1 would need to be {3,2,0,1}. The program outputs the code as L_{3} in that form. The program also displays the degree of the first term. Once you reach the x^{0} term, all the coefficients afterward are the remainders. So, a display of X^2 {3,2,1,5,3} says 3x^{2}+2x+1 and a remainder of 5x+3.
The program first asks for input. It asks for the degree of each polynomial, and then it asks for the contents using a For( loop until there are no more terms. It then commences with the main loop which is another For( loop. The program works in very much the same way people would go about solving a division problem. It divides the current leading terms of the dividend by the first term of the divisor and puts it into L_{3}, our answer. It then does a second For( loop multiplying the partial quotient by every term of the divisor. At the end, it discovers the remainder in L_{1} and stores them into the end of L_{3} for a complete answer.
Here are a couple of examples for you to try out to see if the code was inputted correctly:
(1)Error Conditions
 ERR: INVALID DIM occurs if the degrees are made negative or the divisor's degree is larger than the dividend
 ERR: DIVIDE BY 0 happens if the leading coefficient of the divisor is 0
 ERR: DATA TYPE is thrown if anything is imaginary
Name: Line 2.0 Author: graphmastur Download: line.zip Compatibility: Parent page not set File Size: 16384 (app) 
This program will take the graphscreen and turn it into recallable lines. 
Author: {$author} File Size: {$size} 
{$description} 
Name: Number Words Challenge Author: patriotsfan Download: NW.zip Compatibility: Parent page not set File Size: 1339 bytes 
Converts any number between 0 and 10001 into words. 
Calculates the standard error associated with linear regression coefficients.
L₁  values of the independent variable
L₂  values of the dependent variable
Ans  a 2element list containing the standard errors
L₁, L₂,
TI83/84/+/SE
:2Var Stats
:LinReg(ax+b)
:a√((r²ֿ¹−1)/(n2)){1,√(Σx²/n)}
This routine computes the standard error (uncertainty) associated with the linear regression coefficients a and b (σ_{a} and σ_{b}, respectively) for the regression equation y=ax+b. Precisely stated, the true value of the coefficient a is expected to be within the interval a±σ_{a}, and similarly for b.
The routine returns a twoelement list; σ_{a} is the first element, and σ_{b} is the second element.
If one prefers to use the function LinReg(a+bx) instead of LinReg(ax+b), the appropriate routine is:
:2Var Stats
:LinReg(a+bx)
:b√((r²ֿ¹−1)/(n2)){√(Σx²/n),1}
(note that the meanings of σ_{a} and σ_{b} have now interchanged).
In both routines, r², a, b, n, and Σx² are statistical variables.
Formulas
For the fitting equation y=ax+b,
(1)where n is the number of data points, r² is the coefficient of determination, and Σx² is the sum of squares of the independent variable values.
Error Conditions
 ERR:DIM MISMATCH is thrown if the two lists' sizes are not the same.
Reference
Lichten, William. Data and Error Analysis., 2nd. ed., Prentice Hall: Upper Saddle River, NJ, 1999.
Name: Clock Author: AJLitzau13 Download: TIBD02.zip Compatibility: Parent page not set File Size: No size given 
An analogous clock showing the date and digital time. 
Author: Edward H File Size: No size given 
The string "IVXLCDMvxlcdmni" specifies the letters used in the numerals. The longer you make the string, the more digits the program can handle. To satisfy the program requirements, the string must have at least as many characters as "IVXLCDMvx"; everything else is extra digit support. 
Name: Roman Numerals Author: Mapar007 Download: ROMAN.8XP Compatibility: Parent page not set File Size: No size given 
No description given 
Name: The Matrix Author: builderboy Download: TIBD03.zip Compatibility: Parent page not set File Size: No size given 
This program consists of the "Matrix Effect"; random symbols falling down the screen. When you would press "ENTER", the words "THE MATRIX" would form in the middle of the page, before loading some dialog from the film. 
Author: Xphoenix File Size: No size given 
Asks for the number of sides, then the number of rolls, then displays the outcomes. 
author: Mapar007
description: 'A simple, but fun mastermind game, running entirely on the graph screen.'
arcade: '0'
graphics: '0'
platform: '0'
puzzle: '0'
rpg: '0'
strategy: '1'
sports: '0'
casino: '0'
board: '1'
utility: '0'
misc: '0'
image: '/archives:mastermind10/mastermind_img.JPG'
download: mastermind10.zip
size: '1115'
unit: '1'
Name: Challenge Five: NumeralVerbal Translator Author: Timothy Foster Download: TIBD05.zip Compatibility: Parent page not set File Size: 1500 bytes 
This program will convert any number from 0 to 99999.999 into its word form. Numbers with digits beyond the thousandths place are rounded in the program. The program is very fast, but as a result of incredible speed, it is large. Overall, a great program for writing checks and such. 
Name: Number to word, yo. Author: Edward Hou Download: NUMWORD.8xp Compatibility: Parent page not set File Size: 934 bytes 
Returns any positive real number in English. 
Name: ARC Author: 7thAce Download: ARC.zip Compatibility: Parent page not set File Size: 1377 
Shoot with a power between 2 and 5 and hit the ship. 
Name: Phoenix 1.0 Author: Mapar007 Download: phoenix10.zip Compatibility: Parent page not set File Size: approx. 4500 bytes 
A VERY upgraded version of Mnemon with better interface and remembering utilities. 
As the TIBasic Developer is the most complete resource on the TIBasic, we have decided to take it upon ourselves to construct a portable version of the site. The digital resource will be designed to be printed, and so will be printerfriendly. Compiling a portable version of the site gives the following advantages:
 It would supersede the current manuals TI have already released;
 It would not be necessary to be connected to the internet to access this information;
 A printed version means that even a computer is not necessary to access this information;
 Saves internet usage by people not downloading pages all of the time.
Unfortunately, the portable version of the site is not yet complete. But some parts of it have been compiled:
Although not all parts of the site have been compiled, we are still able to present the Portable Site at its current stage of development. There is also a PDF version (4.05mb).
You may also like to view the discussion of the portable wiki — http://tibasicdev.wikidot.com/forum/t69216/snapanideaforabigproject
Oct  05 —  James Kanjo created a framework for submitting solutions on the challenges page. 
Name: Clock Author: James Kanjo Download: CLOCK.zip Compatibility: Parent page not set File Size: No size given 
Clock for the TI83 and above. Includes date and builtin validation. 
Author: James Kanjo File Size: No size given 
Asks for the number of sides on the die, then for the amount of throws. It includes validation too. 
Author: No author given File Size: No size given 
No description given 
Author: No author given File Size: No size given 
No description given 
Oct  04 —  James Kanjo finished upgrading the News, Did You Know…, Featured Article and Featured Command frameworks on the site. Now it is so much easier to add to these sections of the site, and is filled automatically. It also enables to display randomly selected DYKs, FAs and FCs. 
The featured commands are articles that represent the best TIBasic Developer has to offer. A featured command meets all of the following requirements:
 WellWritten — 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:
Sprites are small images displayed as part of a larger scene on the screen. The most common reasons to use a sprite are to display a picture which will be moved around or repeated multiple times as part of a pattern.
"Tokenization" is the process whereby the characters that make up a command are replaced by a token — a number representing the command.
…that displaying sprites to column coordinates divisible by 8 is faster than to other coordinates?
…that setMode() and similar commands have an alternate "programmer's syntax"?
…that strings are the fastest data type to access, given enough elements?
…that the ok system variable checks if a dialog was cancelled?
…that the 26 oneletter variables az are much smaller to access?
…that the © character can be used to enter comments in programs?
…that ending a variable name with an underscore _ will make solve() and cSolve() assume it's complex?
…that you can treat strings as alwaysundefined variables in symbolic math?
When it comes to releasing a program, you want to make sure your program gets all of the attention that it deserves.
Piecewise expressions are a shortcut to handling conditions in math statements.
They can be used for turning an If block or several such blocks into a single line, creating much smaller and faster code.
A subprogram is a program called by another program, and is used when a task needs to be performed multiple times. The complete program is thus made up of multiple smaller programs that all work together.
Statistics is a mathematical science pertaining to the collection, analysis, interpretation or explanation, and presentation of data.
Optimization involves making programs as fast and small as possible. Speed is important because TIBasic is slow, while size is important because the calculator has limited memory.
The Menu( command displays a generic menu on the home screen, with up to seven options for the user to select from; you can create another menu and link to it, if you need more than seven options.
This is the page that allows you to add excerpts of pages in the TIBasic Developer.
83 Portal  

Featured Articles  Featured Commands  Other 
Add excerpt  Add excerpt  Add excerpt 
68k Portal  

Featured Articles  Featured Commands  Other 
Add excerpt  Add excerpt  Add excerpt 
{$month}  {$day} —  {$description} 
This is the page that allows you to notify the TIBasic Developer community of any news related to the site.
83 Portal  68k Portal  Nspire Portal  All Portals 

Add news  Add news  Add news  Add news 
If you have an announcement that needs to be heard, then please select the appropriate portal.
83 Portal  68k Portal  Nspire Portal  All Portals 

Add Announcement  Add Announcement  Add Announcement  Add Announcement 
2018
2017
2016
2015
2014
2012
2011
2010
2009
2008
2007
2006
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008
2007
2006
Oct  01 —  James Kanjo added a choose a "random command" link to the sidebar…COOL! 
Sep  27 —  Timothy Foster created the page TINspire Programming. 
Sep  15 —  James Kanjo upgraded the framework of the archives. Now it is even easier to add, update, rate and moderate programs! 
Sep  04 —  burr, the founder of the site, has finished contributing to the site, and moved on to other projects. (see his goodbye here) 
Sep  04 —  James Kanjo tagged the 25 remaining untagged redirect pages with the "redirect" tag 
Sep  04 —  basickevin created the page artificial intelligence 
Sep  03 —  RandomProductions created the page How the Calculator Works. 
Sep  01 —  TIBasic Developer has now existed for approximately two years. Thanks to all that made it a great year, and may the next year be even more successful and exciting. 
Jul  14 —  Zaphod Beeblebrox created the page Text Sprites Reference 
Jul  08 —  basickevin created the page alternate routines to promote the creation of new optimizations 
Jul  03 —  burr and James Kanjo set up the framework for the new TIBasic Developer archives 
Jul  01 —  Mapar007 created the page Binary and Hexadecimal number system 
Jun  20 —  Zaphod Beeblebrox changed the resources page to use the tabview 
Jun  13 —  James Kanjo added an "Instant Messenger" routine to the programs page 
Jun  11 —  James Kanjo created a "New Members" section on the 83 and 68k home pages 
Jun  06 —  James Kanjo finished integrating the new infobox framework into all 324 command pages 
May  24 —  RandomProductions spruced up the user input page to be a bit more recent. 
May  18 —  The development of the TIBasic Developer site logo is complete, and has now replaced the previous site header. 
May  15 —  James Kanjo has set up a new framework for infoboxes for the 68k portal of the site. 
May  10 —  James Kanjo has set up a new framework for infoboxes for the 83 portal of the site. 
May  04 —  krazyness initiated the development of the TIBasic Developer site logo, to replace the current header. 
Apr  24 —  DarkerLine has finished the first chapter of the Starter Kit, a tutorial for beginner programmers. 
Apr  23 —  burr created a validation tutorial that covers how to approach validating user input. 
Apr  16 —  burr added a file download to all of the routines and programs. 
Apr  12 —  burr created a TIBasic Sidebar for Mozilla Firefox for quick reference of the TI83 commands when you are away from the site. 
Apr  02 —  James Kanjo made the 83 & 68k pages automatically retrieve the first 5 news items from the old news section. 
Mar  30 —  burr started the Featured Articles page that lists the best articles available on the wiki, along with changing the "Featured Article" section in the sidebar on the homepage into an include page. 
Mar  30 —  burr started the downloads page, and added all of the 68k tutorials that he found on the Internet. 
Mar  27 —  burr started a Did You Know… page with a list of premade DYK's, along with changing the "Did You Know…" section in the sidebar into an include page. 
Mar  25 —  James Kanjo added a warning to the grouping section, which the TIBasic community may have previously been unaware of. 
Mar  16 —  Weregoose created two pages on the calculator's internal fonts. DarkerLine has already found these images useful on other pages. 
Mar  13 —  DarkerLine added include pages which makes adding a new command page much easier. Go for it! 
Mar  08 —  Socks started working on the TIBasic Starter Kit. Feel free to contribute. 
Feb  23 —  RandomProductions put screenshots on all of the date and time command pages. 
Feb  09 —  burr created a portal page, which acts as a bridge between the TI83 and 68k sections of the site, and is now the new homepage for the site. 
Feb  08 —  DarkerLine started a tokenization page, detailing what tokenization is and how it impacts program size and optimization. 
Feb  02 —  DarkerLine put together a calculators page, which provides a brief, but detailed look at the different calculators and their specifications. 
Feb  01 —  DarkerLine started the key codes page, as well as the character codes page. 
Jan  31 —  burr created 68k versions of all of the relevant system pages, which will hopefully minimize any ambiguity or uncertainty about where you are on the site. 
Jan  31 —  DarkerLine added an errors page that lists all of the possible error messages that can occur, including the error numbers and their descriptions. 
Jan  29 —  DarkerLine begins work on the 68k section of the site, creating the homepage, top navigation, command stub and the command index. 
Jan  29 —  All commands have now been documented! Woo! 
Jan  26 —  burr added an optimization walkthrough tutorial which takes a person through the literal process of optimizing a game. 
Jan  24 —  DarkerLine broke up the text manipulation page into a few routine pages: highlighting text, wordwrapping text and marquee. 
Jan  09 —  The zoom commands have been documented, finishing up all commands except for the finance ones. 
Dec  16 —  The xLIB Guru has merged with this wiki, and its content has been added. 
Dec  13 —  The page about user settings, along with its various subpages, is now complete. 
Dec  11 —  burr created a Boolean logic page detailing what Boolean logic is and how you can use it in your programs. 
Nov  27 —  DarkerLine finished writing the pages about the various variable types, and started on the [/settings] commands. 
Nov  24 —  simplethinker started creating pages for the trigonometry and polar functions. 
Nov  18 —  DarkerLine started creating pages for the different variable commands. 
Nov  16 —  DarkerLine finished creating pages for the individual math commands. 
Nov  06 —  burr created a selfmodifying code page explaining what selfmodifying code is and how you can use it. 
Oct  18 —  burr began to create individual routines pages, using the new routine template 
Sep  01 —  TIBasic Developer has now existed for approximately a year. May the next year be even more successful and exciting! 
Jul  26 —  burr put together a Frequently Asked Questions (FAQ) list of common TIBasic related questions that people ask. 
Jul  22 —  burr started a Common Coding Pitfalls page, which lists several different examples of code that are syntactically correct, but do not produce the correct or desired results. 
Jul  01 —  burr started a Code of Conduct page, which lays down some general conduct rules to follow when contributing to the wiki. 
Jun  27 —  burr started a Glossary page, which has general definitions for several of the words that are used throughout the wiki. 
Jun  26 —  burr created a Code Commenting page, which is extremely useful for those people who are working on multiple projects at the same time, and want to be able to come back to a project without all the stress of figuring out what everything is again. 
Jun  23 —  burr finished updating the Subprograms page, so now the external and internal subprograms are explained in comprehensive detail. 
Jun  22 —  Xphoenix added a general section to the Program Setup page, and also created two pages: Assembly Shells and Basic Builder. 
Jun  22 —  burr started a Program Setup page in the same fashion as the Program Cleanup page. Program setup includes getting the home screen, graph screen, and variables ready so your program can use them. 
Jun  18 —  DarkerLine finally finished the Statistics pages. He's going to go back and add complicated formulas no one understands sometime later. 
Jun  13 —  DarkerLine started working on the Statistics pages like he said he was going to a month ago… 
Jun  03 —  Xphoenix created pages for some of the Graph Screen commands. 
May  05 —  Harrierfalcon optimized one of the examples on the Compression Techniques page by using the seq( command. 
Apr  30 —  alexrudd added the xor and not( operators to the Logical Operators page. 
Apr  22 —  burr started the Project Challenges page. After you have gone through the wiki and learned the commands, design theory, and game techniques, you can now test yourself and try your hand at making some programs. 
Apr  21 —  burr started the Old News page, which is the archive place for all the old news and is kept for posterity sake. 
Apr  19 —  A few more games have been added to the Programs page, including: Avalanche, Maze Walkthrough, Pong, and TicTacTo. The programs are all available for download in case anyone wants to try them out on their calculator. 
Apr  15 —  burr added a Wiki Conventions page that lays down some general guidelines about how to format page content. There's a similar Command Stub page for command pages. 
Apr  13 —  thornahawk and Xphoenix added some more information about the Math commands. 
Apr  08 —  burr started the Review Exercises page, which allows readers to test their comprehension and understanding of the information on the wiki. 
Mar  30 —  The Wiki Tour was started, providing a general overview of the wiki and giving beginners some direction about using the wiki. 
Mar  26 —  alexrudd began experimenting with internal page anchors, and has decided that we should try to integrate them into more pages. 
Mar  25 —  DarkerLine started working on the Statistics Commands. These commands are extremely useful for anybody who has to take a statistics class. 
Mar  23 —  burr updated the Contribute page with some guidelines to help beginners better use the wiki. 
Mar  15 —  Harrierfalcon added Number Functionality to Custom Text Input. 
Mar  03 —  burr started the Recursion page. Recursion is related to using subprograms to optimize a program, except the program calls itself instead of other programs. 
Feb  21 —  DarkerLine decided we should give each command its own individual page, so that all the relevant information about that command can be put on one page. Be sure to check out the Command Stub to see how the information is organized. 
Feb  19 —  burr started the Usability page. It offers some ideas to think about when designing a program, including preventing the user from hurting themselves and following the KISS principle. 
Feb  16 —  alexrudd started a Deck of Cards page that should be helpful to anyone who is wanting to learn how to manage the cards in a card game (such as Blackjack). 
Nov  08 —  alexrudd and DarkerLine are promoted to admins, so they are now able to do all of the adminrelated things for the wiki. 
Oct  14 —  burr started the Marketing page. It offers some solid suggestions on ways to market your programs to the community. 
Oct  10 —  burr started the Writing Program Documentation page. Check it out if you are wondering why documentation is important and what things your program documentation should include. 
Oct  07 —  Talks of merging the wiki with the Function Library forum occur, but they ultimately fall through because it is decided that the wiki already covers much of the same content and the forum quality isn't very good. 
Oct  06 —  burr started the LookUp Tables page. Lookup tables are commonly used to increase the speed of programs when speed is the primary need in the program. This is especially true if graphics or user input are involved. 
Sep  24 —  burr started the Custom Text Input page. It shows a simple input routine, briefly explaining how custom text input works and how you can expand the functionality to suit your own purposes and needs. 
Sep  23 —  alexrudd updated the Program Protection page, further refining the different ways to protect a program. In addition, some good discussion about program protection and whether it is appropriate occurred over at the UTI TIBasic forum. 
Sep  23 —  burr started the Program Clean Up page. After a program finishes running, it should clean up after itself. This involves restoring the respective screens, deleting variables, and some other things. 
Sep  22 —  burr started the Optimizations page. The page details the many different optimizations that you can do to a program, organizing them into relevant and related categories. 
Sep  06 —  The wiki is moved from Wikispaces to Wikidot for hosting because the look of the pages and editor is better, and it offers a lot more space for the wiki to grow and mature. 
Sep  01 —  TIBasic Developer wiki is started by burr using the content from his TIBasic Developer guide as the foundation for the wiki. 
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008
2007
2006
…that
…that it is actually sometimes better to leave on the closing parentheses on the For( loop?
…that a memory leak is caused when you use a Goto/Lbl within a loop or If conditional (anything that has an End command) to jump out of that control structure before the End command is reached?
…that you can omit the closing parentheses, quote, square bracket, curly brace, etc. at the end of a command or function?
…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 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 PtOn(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 there are 256 picture variables builtin to the TI83+ calculator, even though the calculator only shows 10 picture variables?
…that you can enable the faster circle drawing flag on the TI83/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 TI83) 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 TI83/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 TIBasic 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 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 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 TIBasic commands to the newer TI84+/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 TI83 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 (noninteger) negative numbers?
…that lists are the only variable that you can give your own names to?
.