Disaster

archive.png

Command Summary

Moves a variable from RAM to the archive.

Command Syntax

Archive variable, [another, …]

Menu Location

Starting in the program editor:

  • Press F4 to enter the Var menu.
  • Press 8 to select Archive.

Calculator Compatibility

This command works on all calculators.

Token Size

3 bytes

The Archive command moves a variable, or several variables, from RAM to the archive. This serves two purposes:

  • More RAM is now available for other variables.
  • The variable is protected from being edited or deleted.

On the 68k series of calculators, a variable in the archive can still be read (compare this to the behavior of TI-83 series calculators, where doing anything at all to an archived variable is forbidden). However, trying to store anything to the variable will give an error: it must be unarchived first.

Variables in the archive are also protected from being deleted. This means that a DelVar command called on it will cause an error. Commands such as NewProb or DelType that delete multiple variables will skip over any that are archived. Finally, in the event of a RAM clear (which is more likely to happen by accident than a total memory clear), archived variables will be preserved.

Any type of variable can be archived. However, you cannot archive system variables (such as xmin) or variables beginning with _.

Advanced Uses

It seems natural to archive programs, since they usually aren't written to, and they are valuable enough that you want to give them some protection. However, keep in mind that the first time you run a program after editing it, it gets tokenized — the text is converted into tokens that stand in for commands. The process might take several seconds.

If you edit a program and then immediately archive it, it is "protected" from this conversion process. That means that every time you run the program, it will be tokenized. To avoid this, run the program once to tokenize it, and then archive it.

Error Conditions

140 - Argument must be a variable name happens when archiving a system variable or an invalid variable name.

870 - Reserved name or system variable happens when archiving a variable starting with _.

960 - Undefined variable happens when archiving an undefined variable.

Related Commands

approx.png

Command Summary

Gives a decimal approximation of an expression.

Command Syntax

approx(expression)

Menu Location

While on the home screen:

  • Press F2 to enter the Algebra menu.
  • Press 5 to paste approx(.

Calculator Compatibility

This command works on all calculators.

Token Size

1 byte

The approx() command forces an expression to be evaluated in approximate mode, temporarily ignoring the mode setting. It's equivalent to pressing ♦ and ENTER when performing a calculation on the home screen.

:approx(π)
           3.14159265359

When applied to a complicated expression, matrix, or list, it approximates every number that occurs there.

Related Commands

Program Archives

The program archives is a stash of the various programs and games that can be downloaded from the computer onto your calculator.

The Routines

This is where most of the helpful code is. Routines will help you accomplish some tasks that cannot normally be done with a simple command. If you need help converting numbers to strings or adding the digits in a number, this is the place to go.

The ListPages module does not work recursively.

Alternate Routines

This page will show some alternate ways to do things to either gain a speed advantage, size advantage, or accomplish more than one thing. Sometimes, a simple routine won't do in a program, and this page will show you some new ways to accomplish the same task.

The Programs

A program will give an opportunity for input and for sure gives some sort of output. The programs provide examples of certain goals being met. These will also show you how to create input and output in crafty ways to help you become a more competent programmer.

The Games

The games here are very simple ones, but they use all of the design and techniques discussed in this wiki. These games are an example of what TI-Basic has to offer and how the techniques can be combined to create a full-fledged game.

Member

Tricks on the calculator. We've all been guilty of thinking, "Wow, it would be cool to screw up his calc." What? Only me?

Anyways, the only thing stopping you is knowledge. More specifically, the knowledge of how to do it.

The most basic trick is an infinite loop. Create a new program, call it whatever you want, and use the following code (Substitute the program's name for A):

:prgmA

But this is boring. Let's screw up their math.

:Input "",A
:Disp ArandInt(2,5
:prgmA

Note that both of these programs can be broken by pressing ON.

This page is for knowledge's sake only. We don't encourage you to try any of this, and we are not responsible if you do.

Member

Member

Dec 06 An announcements box is created.
Dec 06 It has been decided that the TI-Basic Starter Kit take priority in member contribution. Remember that the goal of the starter kit is to give a person of no programming knowledge a good solid start on calculator programming.

{$month} - {$day} : {$announcement}

ANNOUNCEMENT HERE

The ListPages module does not work recursively.

Add Announcement»

Member

Name: Timer
Author: HJTP
Download: Timer.zip
Compatibility: Parent page not set
File Size: 1500 bytes
A program containing a digital timer and a digital and analog clock.
Dec 03 graphmastur does not match any existing user name created a new page that allows you to upload files to use on any page. It can be found at the files page.

No files attached to this page.

Name: Timer
Author: HJTP
Download: timer.zip
Compatibility: Parent page not set
File Size: 1500
A timer which contains digital and analog clocks

Member

Member

The ListPages module does not work recursively.

This is a list of all the programs categorized as an RPG. These programs are ones that tell a story while you control a character.

This is a list of all the programs that cannot be specially categorized. These programs are none of the other categories, so this bunch of programs could be anything you don't expect.

This is a list of all the programs categorized as a Utility. These programs are tools that help you in given situations, from helping you design graphics to doing your laundry!

This is a list of all the programs categorized as a Board Game. These programs emulate the typical board games like Monopoly, Sorry, Chess, etc.

This is a list of all the programs categorized as a Casino Game. These programs use cards and dice to entertain your lucky side.

This is a list of all the programs categorized as a Sports Program. These programs have something to do with sports whether it be a game or helping tool.

This is a list of all the programs categorized as a Strategy Game. These programs are usually multiplayer which requires you to outsmart your opponent.

This is a list of all the programs categorized as a Puzzle Game. These programs provide a mind-bending experience as you proceed with solving problems and completing tasks.

This is a list of all the programs categorized as a Platform Game. These games are the ones that rely primarily on jumping, two dimensional graphics, and screen scrolling, much like Super Mario.

This is a list of all the programs categorized as a Graphics Program. These programs display stunning manipulation of the graph screen or else help you with making good graphics.

This is a list of all the programs categorized as an Arcade Game. These programs are usually simple, and yet they can be very addicting — Much like games you would find in a video arcade.

Dec 01 The Program Archives have been updated to include categorization.

What is interesting about today is that JamesKanjo has returned to his hovering project.
Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum.

The binomcdf( command calculates the binomial cumulative probability, either at a single value or for all values. This command can be used to replace seq( when used with cumSum(.

(Read more...)

Nov 30 Timothy Foster has been promoted to Moderator status.

The development of a program is essential to its ability to succeed and be good. The development is a cycle that can be repeated as many times as desired, each time making a new version. This cycle will allow you to make your program usable, efficient and clean. Here is a list of the parts of the development cycle and the parts of each.

Planning

Coding

Revising

Releasing

Refreshing

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

There are various techniques you can use within your program in order to emulate different elements used in games and math. Here is a list of techniques you can use to accomplish all the elements of a good game and more.

The ListPages module does not work recursively.
<< Code Conventions Overview Commenting Code >>

If you feel that you have accomplished and mastered the art of programming, then the next step is to use that new skill in application. Test your knowledge with challenges and projects, and study professional routines and games to expand on what you know.

Review

This is a comprehensive test on your knowledge of TI-Basic. It contains questions with answers to see if you are knowledgeable in the arts of programming.

Challenges

These are the programming challenges that are put forth by other members of the community. Try your hand at the grueling dares by creating a program that best fits the criteria.

Project Ideas

These are some of the project ideas to help you get started on some major programming stuff. If you need an idea or illumination, then try this corner.

Projects

Here are some projects currently going on here at TI|BD! Feel free to participate in these community oriented programming projects.

Routines

These quick chunks of code allow you to get through your programming without the hassle of inventing something already invented. These are optimized and ready for you to use them, of course whenever you need it.

Programs

A program will give an opportunity for input and for sure gives some sort of output. The programs provide examples of certain goals being met. These will also show you how to create input and output in crafty ways to help you become a more competent programmer.

Games

The games here are very simple ones, but they use all of the design and techniques discussed in this wiki. These games are an example of what TI-Basic has to offer and how the techniques can be combined to create a full-fledged game.

Member

Member

Nov 28 The home page has been revamped and the top and side bars have been switched to provide a fresh look to the site.

Member

Name: Blackjack 2.14
Author: Ray Wang
Download: blackjack_v2.zip
Compatibility: Parent page not set
File Size: 5361 bytes
This originally started out as a simple text-based version of Blackjack that I made, until I figured out how to get graphics working BASIC programs. Now includes betting and an auto-money-saver-type-thing.

The If command is used to determine what path of action gets done depending on a condition. With this command, you can set If…Then or If…Then…Else blocks for the calculator to interpret.

(Read more...)

Name: BC's Beta Tetris
Author: ibly31
Download: BC's Beta Tetris
Compatibility: Parent page not set
File Size: 2334 Bytes
Fun beta Tetris in a small package!
The ListPages module does not work recursively.
Getting Involved

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

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

Forum Activity
The only form of commenting that is available in TI-Basic looks like this :line(s) of...
(by kg583 21 Nov 2017 00:36, posts: 2)
So the majority of my programming experience is with G code and I’m able to put notes and other t...
(by MachineKeen 21 Nov 2017 00:33, posts: 2)
Well to be very specific I’m creating a program to calculate ingredient weights using bakers p...
(by MachineKeen 21 Nov 2017 00:27, posts: 5)
Did You Know...
The ListPages module does not work recursively.
Top Rated Programs
The ListPages module does not work recursively.
Featured Article
The ListPages module does not work recursively.
Featured Command
The ListPages module does not work recursively.

Welcome to the TI-83 section of TI-Basic Developer (TI|BD)! This section of the site covers how to make TI-Basic programs for the TI-83, TI-83+, TI-83+ Silver Edition (SE), TI-84+, and TI-84+ Silver Edition calculators (often abbreviated as TI-83/84/+/SE). After going through all of the TI-83 information, the reader should be a competent TI-83 Basic programmer.

Image Here

Site Content

Search

We've tried to create a broad base of TI-Basic information. This ensures that most readers will hopefully be able to learn something from this site. Experimentation is encouraged to fully digest all of the information.

Please use our search engine to find what you desire, or refer to the sitemap.

Each reader can read the information in whatever order they desire. For the average reader, though, the suggested approach is to just start from the beginning and read until the end. The information is presented in a sequential order, with the concepts and code getting increasingly more complex as you get further into it. You might also look at the page Using This Guide, which outlines another suggested reading order.

Please feel free to not only get involved, but also come back often to see what changes or additions have been made. And above all else, enjoy your stay!


Recent News

TI|BD is constantly changing through the efforts of its members. Here are the most recent significant edits that have been made. For the complete documentation of the history, see News Depository.

The ListPages module does not work recursively.

If you have made a significant modification, made a new page, or contributed to this site in another way, please document what you did by adding news.


Portable Guide

As a part of this site's growth, we have created a portable guide for you to print out and have as a programming source wherever you go. The portable guide contains most of this site's content in a printable format including all the commands, techniques, and calculator references.

Go to the Portable Guide for TI|BD.


New Members

It is only by our members that this site can grow. Welcome to the new members who have joined TI|BD:

The ListPages module does not work recursively.
Nov 25 We receive news that the TI-Basic Developer, after two years of hard work and effort by its members, has become a popular site within the Wikidot community, the site that hosts this wiki and many others. This represents a major turning point for TI-BD.
Name: U.S. Presidents
Author: patriotsfan
Download: U.S. Presidents.zip
Compatibility: Parent page not set
File Size: 10628 bytes
This program contains all United States presidents and info on each of them. It is great for History class!
Name: Slideshow 83+
Author: Basickevin
Download: Slideshow.zip
Compatibility: Parent page not set
File Size: 1992+767 per slide
The ultimate slide editor, viewer, and slideshow presenter. Allows for complete manipulation of any picture you want to view and easily allows for cool little presentations. Includes design templates and clip art.
Name: Yahtzee
Author: 7thAce
Download: Yahtzee! v1.2.zip
Compatibility: Parent page not set
File Size: 4100
A Casino game where you roll 5 dice three times and try to accumulate the highest score with your rolls. Played on the graph screen
Nov 21 A new members system is used for members which gives each member a profile page.
Name: Dot Mania 1.40
Author: Rhombus p.
Download: Dot Mania 1.4.zip
Compatibility: Parent page not set
File Size: 4857 bytes

this program includes three games that has every thing to do with dots

New in version 1.4

  • Smaller
  • Faster
  • New Splash Screen

New in version 1.3

  • Runs Faster!
  • Size reduced by 600 bytes
  • bug fixes!

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Admin

WAC

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

A

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

C

Member

Member

Member

Member

C

Member

Member

Admin

WA
userkarma.php?u=260544&onlyKarma=truea48.png Recipito (profile)

Joined Mar 23


Time Zone: Not given

Member

Member

Member

Member

Member

Member

C

Member

Moderator

Member

Member

Member

We are dealing with a graphing calculator after all, so it makes sense that there are lots of graphics commands to talk about. Although the graphical capabilities of the calculator are limited (a monochrome LCD with either 160x100 or 240x128 resolution) these commands allow programmers to squeeze everything out of the screen that they can.

This page is divided into two sections: "Drawing commands" for general tasks like drawing lines, circles, or individual pixels, and "Graphing commands" which deal with the graphs of various functions. If you're not interested in the math aspects of graphics, you might want to skip the second section, especially at first reading.

However, all functions discussed on this page share a common aspect: their difference from normal graphing. When an equation variable is graphed, the result is semi-permanent: using a command like ClrDraw to clear the screen, or changing some setting, can do nothing more than cause the graph to be redrawn. However, all of the commands on this page produce "drawn items" which disappear permanently when the screen is cleared.

Drawing Commands

If you want to draw an image on the screen, you have two choices. First, you can build it up from simple shapes like dots, circles and lines. This may work great for an user interface, but it pretty much limits you to stick figures when you want to draw anything more complicated. So the other option is to have a picture already stored in a variable, and just display it to the screen as you need to. We'll cover both of these in order.

A universally useful drawing command is ClrDraw: this clears everything drawn on the graphscreen.

Point vs. Pixel

TI-Basic allows two ways of specifying a location on the screen: "point" coordinates and "pixel" coordinates. The point coordinates are the ones that you see most often: they are the coordinates determined by the graphing window, with (xmin,ymin) being the bottom left corner and (xmax,ymax) the top right. Because the graphing window has to be initialized if you want to use these in a logical way, this is NOT usually the best type of coordinate to use.

The alternative is pixel coordinates ("pixel" refers to the individual dots that make up the calculator screen). The graphscreen is made up of 77 rows and 159 columns of pixels, and 103 rows and 239 columns on a widescreen calculator (this ignores the rightmost column of pixels, which can't be drawn to). So the pixel coordinates refer to each pixel by the pair (row,column). This is actually the reverse of the point coordinates: the first number determines the vertical location, and the second number the horizontal location. The rows and columns are numbered starting from 0, and the 0th row is the top row. So (0,0) refers to the top left pixel of the graphscreen, and (76,158) or (102,238) refers to the bottom right pixel.

For pretty much every drawing command, you have to specify a location on the graphscreen at which to draw. You can choose either type of coordinate (although your life will be simpler with pixel coordinates) — for every point command, there's a matching pixel command, and vice versa (with an exception we'll get to later).

For example, you can draw a line with the Line command, and the syntax will be:

Line x1,y1,x2,y2

Or you can use the PxlLine command, with the syntax:
PxlLine row1,col1,row2,col2

The following table gives you all the simple drawing commands in their two forms:

Point Coordinates Pixel Coordinates
Circle PxlCrcl
Line PxlLine
LineHorz PxlHorz
LineVert PxlVert
PtChg PxlChg
PtOff PxlOff
PtOn PxlOn
ptTest() pxlTest()
PtText PxlText

Sprites

Using picture variables, you can store a rectangular image of any size, to be displayed on the screen later. In video game language, such an image is often called a sprite.

The several commands that deal with picture variables are covered in-depth in the Sprites article (CyclePic is described in the Animation article because, you guessed it, it lets you display an animated image). One important thing to note is that they only use pixel coordinates — another reason to use these.

The seven sprite commands are:

Graphing Commands

The usual way of graphing is to store to an equation variable such as y1(x), and then simply go to the graph screen (where you can resize the window and other fun stuff). For the convenience of programmers, any sort of graph manipulation you can choose from a menu is also available as a command. The 68k calculators also provide another way of graphing, probably more suitable to programmers, which draws a graph of a specific expression.

Graphing Expressions

These simulate graphing an equation from any graphing mode. Of special note is the Graph command — unlike the other commands, which can be erased with ClrDraw or any other way of refreshing the screen, the output of Graph can only be erased by ClrGraph or by going to the Y= screen to re-enable the normal Y= functions.

Zoom Commands

The zoom commands resize the graphing window determined by xmin, xmax, ymin, and ymax. For the most part, these four variables are all they change. The exception is ZoomStd, which restores certain other values to their defaults, and ZoomSto and ZoomRcl, which back up and restore all window variables.

Graph Manipulation

These final commands are more or less miscellaneous. Their uniting characteristic is that they deal with the graph of an actual equation variable (the ones you edit in the Y= screen). Of these, FnOff is probably the one to remember: it turns off all equation variables without actually deleting them.

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Member

Moderator

Member

Member

Member

Member

Admin

WF

Member

Member

Member

Joined Sep 07 noahbaby94noahbaby94

Time Zone: -6 GMT
Birthday: 09/02/1994

How I Found TI-Basic Developer

Looking for a way to convert numbers to strings.

How I Began Programming

Math class needed to know how to program.

Best Program: Quadratic

Member

Member

Member

Member

Member

Member

Member

Member

Member

Admin

W

Member

Admin

Member

Admin

FWDAC

Time Zone: Not given


Time Zone: {$timezone}
{$birthday}

{$aboutme}

{$howifoundtibd}

{$howibeganpgrming}

{$hobbies}

{$mybestprogram}

Joined {$month} {$day} UsernameUsername

char.png

Command Summary

Returns a character given its ASCII code.

Command Syntax

char(code)

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press D to enter the String submenu.
  • Press A to paste char(.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

The char() command converts an integer between 0 and 255 to the corresponding character in the calculator's internal code (which is a modification of ASCII). It can also operate on a list or matrix by converting each of their elements to a character.

This command, and its inverse ord(), can be useful for programs that deal with arbitrary strings (which could, potentially, contain any character), but they can come up in other cases as well. For example, since the letters A..Z are consecutive characters in the calculator's internal code, with A being char(65), you can calculate the nth letter in the alphabet with the expression char(n+64).

There are two special values of char() to be aware of. The character given by char(0) is actually the empty string, which you usually want to avoid using; the character given by char(13) is a newline "enter" character, which is replaced by ":" when you type it somewhere. If you actually want to store char(13) to a string, you have to use the char() command.

Advanced Uses

TI-Basic does not allow lists to contain picture variables, and in many cases (such as tilemaps) you want to get around this limitation. One way to do so is to name the variables "tile1", "tile2", "tile3", and so on, with only the number changing — then #("tile"&string(n)) gives the nth picture variable.

A more efficient way is to assign the pictures numbers in a different range, such as 65-90, and name the variables "tilea", "tileb", "tilec", etc. Then, #("tile"&char(n)), which is faster, converts a number to the corresponding picture variable. This allows for a maximum of 146 different tiles, if you use all the characters that could conceivably be part of a variable name.

Error Conditions

260 - Domain error happens when the character code isn't in the range 0..255.

Related Commands

See Also

mid.png

Command Summary

Selects a substring from a string, or a sublist from a list.

Command Syntax

mid(string-or-list,start[,count])

Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press D to enter the String submenu.
  • Press 5 to paste mid(.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

The mid() command can be used in two ways: to select a sublist from a list, or a substring from a string. In both cases, the syntax is similar:

  • the first argument is the list or string to start with.
  • the second argument is the number of the first element or character to include,
  • the third argument is how long the sublist or substring should be.

That is, mid(list,x,y) will give a list of the xth element, (x+1)th element, and so on up to the (x+y-1)th element of list. If x=2 and y=3, this will give a 3-element list starting from the 2nd element.

:mid({1,2,3,4,5},2,3)
    {2 3 4}

For strings, mid(string,x,y) will give a y-character-long string starting from the xth character of string:
:mid("TI-Basic",2,5)
    "I-Bas"

In practice, the mid() command is rarely useful for lists, although it might occasionally come in handy. It really shines with strings, since there is no other way to select a character from within a string. Whereas you might use list[5] to select the 5th element of a list, with a string you have to write mid(string,5,1) to get that single character.

A noteworthy feature of mid() is that out-of-bounds indices don't cause an error. If the length you give for the substring or sublist is more than the number of remaining characters or elements, then it will give you as many as there are, instead. If the value of start happens to be past the end, then the output will be a null value: the empty list {} for a list, and the empty string "" for a string.

Optimization

The third argument — the length of the sublist or substring — is optional if you want to include everything past the first element or character. For example:

:mid({1,2,3,4,5},3)
    {3 4 5}
:mid("TI-Basic",4)
    "Basic"

In this case, the result is the same as the result of right(), but the input is different.

Furthermore, if you're always going to start at the beginning of the string, left() is a better alternative to mid(): left(var,x) is equivalent to mid(var,1,x), and saves you a total of 3 bytes.

:mid(str,1,5)
    can be
:left(str,5)

Error Conditions

260 - Domain error happens when start isn't positive, or count is negative.

Related Commands

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
toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it. Do we need this page?

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 L1 and L2. 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

TI-Calculators 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 >>
toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it.

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 TI-84+CSE or TI-84+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!

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 non-zero 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 one-byte 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(A-75

X=n1 or X=n2 should become abs(n1-mean({n1,n2}))=abs(X-mean({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}))
:Ans-8(Ans=9)+8(not(Ans))→A
:B+sum(ΔList(K={24,26}))
:Ans-16(Ans=17)+16(not(Ans))→B
:C+randInt(-1,1)
:Ans-8(Ans=9)+8(not(Ans))→C
:D+randInt(-1,1)
:Ans-16(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}))
:Ans-8(Ans=9)+8(not(Ans))→A
:B+sum(ΔList(K={24,26}))
:Ans-16(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)
:Ans-8(Ans=9)+8(not(Ans))→C
:D+randInt(-1,1)
:Ans-16(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

  1. What command will automatically unarchive a list and create it if it doesn't exist?
  2. What data type would you use to save a highscore?
  3. What is the seed and what is it useful for?
  4. What type of loop is appropriate to use for a game like Yahtzee?
  5. What is the code for movement?
  6. 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?
  7. Can you use the sub( command to find the element in a matrix?
  8. Make a formula using rand as the only random command to yield the same results as randBin( with a given seed of 0.
  9. 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

<< 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'

toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it. Add more pertaining to division, exponentiation, and negation/subtraction

Optimizing math operations is a great way to make your programs more understandable and faster.

Simple Things

When optimizing any code in TI-Basic, 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)=2X2+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 size-wise 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 y-coordinate. 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 x-coordinate, 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 0-94 and 0-62 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.

Pxl-On(

The Pxl-On( 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)
:Pxl-On(30,46)
:Pxl-On(30,48)

Pxl-Off(

Pxl-Off( is used to turn a pixel off. It's arguments are the same as Pxl-On. 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 Pt-On (which is coming right after this) and its special 'mark' argument and then turn off the 2 pixels we don't need.

:Pt-On(47,-32,3)
:Pxl-Off(31,47)
:Pxl-Off(33,47)

Pxl-Change(

Pxl-Change( swaps the current state of a pixel. The arguments are identical to those used with Pxl-On and Pxl-Off. 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 Pxl-Change( and the bottom uses Pxl-On/Pxl-Off.
pxlChangeScreenshot

The code for the bullet(s) is

:For(A,46,94)
:Pxl-Change(16,A)
:Pxl-Change(16,A-1) \\Top part
:Pxl-On(36,A)
:Pxl-Off(36,A-1) \\Bottom part
:End

There is very little difference between the code for each but there are major differences between the outputs!.

Pxl-Test(

pxl-Test( 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/un-drawing 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 y-coordinate 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 one-pixel point. Two is a box with the center missing. Three corresponds to a little '+'.

Pt-On(

Pt-On( draws the 'mark' at the indicated point. The extra 'mark' argument allows you to make more complicated graphics without drawing them pixel-by-pixel. Below shows how the different marks can be used for a snake/nibbles game.
snakeScreenshot

Pt-Off(

Pt-Off( 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 cool-looking point is

:Pt-On(20,-20,2)
:Pt-Off(20,-20,3)

This will only leave the corner pixels of the little box.

Pt-Change(

Pt-Change( switches the state of the point. Unlike the other two point commands there is not 'mark' argument making this essentially Pxl-Change( 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 Pxl-On, Pxl-Off, and Pxl-Change 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 Pxl-On( command, as shown below.

:ClrDraw
:Pxl-On(82,132,RED //Draws a red pixel near at the center of the screen
:Pxl-Off(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
:Pxl-On(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 Pxl-Change( command can be used in a similar fashion as Pxl-On(, 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
:Pxl-Change(82,132,YELLOW

The Pxl-Test( command works the same as it does on the monochrome calculators, but there is one catch: Pxl-Test( cannot be used to test for the color of a pixel, just whether it is on or off. Though this is an annoying handicap, Pxl-Test( 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 Pt-On( 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
:Pt-On(0,0,1,GREEN
is the same as
:Pt-On(0,0,GREEN //The calculator will recognize no mark is given and draw the default point
:Pt-Off(0,0 //Turns off the point regardless of color

The Pt-Change( command, like the Pxl-Change( 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
:Pt-Change(0,0,ORANGE

Just like with monochrome calculators, there is still no mark argument for Pt-Change(.

<< Introduction to the Graphscreen Table of Contents Graph Format Settings >>
toolbar-separator.png This article is currently in development. You can help TI-Basic Developer by expanding it.

In the starter kit, the link to this page has been re-linked to a more thorough, non-starter 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.

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 If-Then conditional, you should combine the Disp statements so you can change the If-Then 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-(B-C))

can be optimized to
:Output(1,1,A-B+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
:Pxl-On(A,B
:Pxl-On(C,D
:Text(-1,28,31,"READY?
:Pause
:For(E,26,36
:Line(29,E,67,E,0
:End
:Repeat G=45 or not(pxl-Test(A,B) and pxl-Test(C,D
:getKey
:If Ans
:Ans→G
:A+(G=34)-(G=25→A
:B+(G=26)-(G=24→B
:1+pxl-Test(C+1,D
:Ans+(Ans=2 and pxl-Test(C,D-1
:Ans+(Ans=3 and pxl-Test(C-1,D→F
:C+(Ans=1)-(Ans=3→C
:D+(F=4)-(F=2→D
:Pxl-Change(A,B
:Pxl-Change(C,D
:End

This is a tutorial on how to upload files onto the TI-Basic Developer. It has been requested that a step-by-step guide be created, as the process can be quite complicated to new contributors.

I am going to create a picture file to be uploaded…

Screenshot_01.PNG

Now I need to save it. Click "File", then "Save As…"

Screenshot_02.PNG

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:" drop-down box, and select "PNG (*.PNG)".

Screenshot_03.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 "see-through" backgrounds).

I have saved my image on the desktop:

Screenshot_04.PNG

The next step is to open up your favourite web-browser, and navigate to the page you want to upload your file on. In my case, it's the 83 home page:

Screenshot_05.PNG

Scroll to the bottom of the page, and in the bottom-right 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 top-right hand corner of the page). Now click on the "files" button (which conveniently appears in red in this image):

Screenshot_06.PNG

A menu appears just below the buttons. Click on the "upload new file" link, which has also conveniently appeared in red for some reason:

Screenshot_07.PNG

Another menu appears below. Now click the "Choose File" button:

Screenshot_08.PNG

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:

Screenshot_09.PNG

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 file-name all one word, and all lowercase. We are going to do that now:

Screenshot_10.PNG

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:

Screenshot_11.PNG

Hooray! Your file is now uploaded to the TI-Basic Developer! You will notice the list of files (arranged automatically in alphabetical order) now contains your file. Click on the "info" link:

Screenshot_12.PNG

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.

Screenshot_13.PNG

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 L1 through L6, 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 two-dimensional 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 built-in 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 built-in 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 ill-defined 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 built-in 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 TI-83+/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 TI-83 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 TI-83. 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 two-dimensional 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 x-axis uses numbers 1-16, and the y axis uses numbers 1-8. 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 2-3, real variables can be used. However, for large amounts of objects, like 4-10 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](A-1,B)≠1)+(K=34 and not([A](A+1,B))→A
:B-(K=24 and not([A](A,B-1))+(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!

Full-screen on a TI-84+ CSE/CE

The TI-84+ 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 full-screen 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 full-screen 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:spin-pong/spinpong.gif'
download: Spin%20Pong.zip
size: '523'
unit: '1'

Routine Summary

Finds the remainder of a division between two numbers.

Inputs

A,M

Variables Used

A,M

Calculator Compatibility

TI-83/84/+/SE

:A-Mint(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.
tags="+_challenge {$tags}"
Nov 03 thornahawk finished the invT( command. Now all calculator commands documented (again!)

Command Summary

Calculates the inverse of the cumulative Student's t-distribution function with degrees of freedom ν.

Command Syntax

invT(probability, ν)

Menu Location

Press:

  1. 2ND DISTR to access the distribution menu
  2. 4 to select invT(, or use arrows.

Calculator Compatibility

TI-84+/SE (OS 2.30 or greater)

Token Size

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 so-called "one-tailed' tests; for two-tailed 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 closed-form 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)
\begin{align} \definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} \operatorname{invT}(p,1)=\tan\left(\pi\left(p-\frac1{2}\right)\right) \end{align}

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.

The ListPages module does not work recursively.

TI-Basic Developer

The TI-Basic Information Repository

The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
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 pop-up 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

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:

professional%20window

If you want a window for a game, say one that is supposed to look medieval, then this might be an appropriate window:

medieval%20window

You just have to experiment with what window looks good and what would work with your game/program.

Pop-up 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 pop-up 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:
pop%20up%20window

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.
Game%20screen

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 TI-Basic 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 multi-functions 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.

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, 2x2+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 If-Then 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 messed-up 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 >>
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.
The ListPages module does not work recursively.

Command Summary

Calculates the linear regression of two sets of data with a confidence interval for the slope coefficient.

Command Syntax

LinRegTInt [x-list, y-list, [frequency], [confidence level], [equation]]

Menu Location

Press:

  1. STAT to access the statistics menu
  2. RIGHT to access the TESTS submenu
  3. ALPHA G to select LinRegTInt, or use arrows

Calculator Compatibility

TI-84+(SE) OS 2.30 or greater

Token Size

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 x-coordinates and one of the y-coordinates, 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 x-list and y-list 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

divide.png

Command Summary

Divides one number by another.

Command Syntax

value1 / value2

Menu Location

Press the [/] key to paste /.

Calculator Compatibility

This command works on all calculators.

Token Size

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

  • - (subtract)
  • * (multiply)
  • + (add)

See Also

multiply.png

Command Summary

Returns the multiplication of two numbers.

Command Syntax

value1 * value2

Menu Location

Press the [*] key to paste *.

Calculator Compatibility

This command works on all calculators.

Token Size

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 ath row of the first matrix with the bth 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

  • - (subtract)
  • + (Add)
  • / (divide)

See Also

subtract.png

Command Summary

Returns the difference of two numbers.

Command Syntax

value1 - value2

Menu Location

Press the [-] key to paste -.

Calculator Compatibility

This command works on all calculators.

Token Size

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 .-.

:1-1
           0
:5→x
:2-3x
           -13
:[1,2;3,4]-100
           [-99  2]
           [3  -96]

Related Commands

  • + (add)
  • * (multiply)
  • / (divide)

See Also

add.png

Command Summary

Returns the sum of two numbers.

Command Syntax

value1 + value2

Menu Location

Press the [+] key to paste +.

Calculator Compatibility

This command works on all calculators.

Token Size

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

  • - (subtract)
  • * (multiply)
  • / (divide)

See Also

Oct 26 Manual-Fit command is first created. Only two commands left to go…
SCREEN02.BMP

Command Summary

Allows user to create a line of best fit and modify it

Command Syntax

Manual-Fit {Function}

Menu Location

Under Statistics or Catalog

  1. Press STAT
  2. Go to CALC
  3. Press ALPHA D (or scroll to bottom)

Calculator Compatibility

TI-84+/SE (OS 2.30 or greater)

Token Size

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.

:Manual-Fit
(this activates the command and stores to Y₁
:Manual-Fit 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:

:Manual-Fit
: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

L1- Dividend
L2- Divisor

Outputs

L3- Quotient coefficients in descending degree

Variables used

L1, L2, L3, A, B, D

Calculator Compatibility

TI-83/84/+/SE

Author

Timothy Foster

Download

polydiv.8xp

:DelVar L₃
:For(A,1,dim(L₁)+1-dim(L₂
:L₁(A)/L₂(1→L₃(A
:For(B,2,dim(L₂
:L₃(A)L₂(B
:-Ans+L₁(A+(B-1→L₁(A+(B-1
: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 L1 is the degree+1 of the dividend polynomial, and the dimension of L2 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 3x3+2x2-1 would need to be {3,2,0,-1}. The program outputs the code as L3 in that form. The program also displays the degree of the first term. Once you reach the x0 term, all the coefficients afterward are the remainders. So, a display of X^2 {3,2,1,5,3} says 3x2+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 L3, 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 L1 and stores them into the end of L3 for a complete answer.

Here are a couple of examples for you to try out to see if the code was inputted correctly:

(1)
\begin{align} {x^2+3x-2 \over x+1} = x+2- {4 \over x+1} \hspace{12pt} \{ 1,2,-4 \} \end{align}
(2)
\begin{align} {x^4+3x^2-2x+1 \over x^2+4x+6} = x^2-4x+13-{30x+77 \over x^2+4x+6} \hspace{12pt} \{1,-4,13,-30,-77\} \end{align}

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.

Routine Summary

Calculates the standard error associated with linear regression coefficients.

Inputs

L₁ - values of the independent variable
L₂ - values of the dependent variable

Outputs

Ans - a 2-element list containing the standard errors

Variables Used

L₁, L₂,

Calculator Compatibility

TI-83/84/+/SE

:2-Var Stats
:LinReg(ax+b)
:a√((r²ֿ¹−1)/(n-2)){1,√(Σx²/n)}

This routine computes the standard error (uncertainty) associated with the linear regression coefficients a and ba 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 two-element 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:

:2-Var Stats
:LinReg(a+bx)
:b√((r²ֿ¹−1)/(n-2)){√(Σ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)
\begin{align} \definecolor{darkgreen}{rgb}{0.90,0.91,0.859}\pagecolor{darkgreen} \begin{align*} \sigma_a&=a\sqrt{\frac{\frac1{r^2}-1}{n-2}} \\ \sigma_b&=\sigma_a\sqrt{\frac{\Sigma x^2}{n}} \end{align*} \end{align}

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

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.

toolbar-separator.png This is a featured article, which means it is one of the best articles available on TI-Basic Developer. A featured article not only is well-written, but includes everything about the topic, as well as references (if applicable). You can see more featured articles by going to the featured articles page.

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:mastermind-1-0/mastermind_img.JPG'
download: mastermind10.zip
size: '1115'
unit: '1'

Name: Challenge Five: Numeral-Verbal 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.
The ListPages module does not work recursively.
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 TI-Basic Developer is the most complete resource on the TI-Basic, 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 printer-friendly. Compiling a portable version of the site gives the following advantages:

  1. It would supersede the current manuals TI have already released;
  2. It would not be necessary to be connected to the internet to access this information;
  3. A printed version means that even a computer is not necessary to access this information;
  4. 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:

The ListPages module does not work recursively.

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/t-69216/snap-an-idea-for-a-big-project

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 TI-83 and above. Includes date and built-in 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 TI-Basic Developer has to offer. A featured command meets all of the following requirements:

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

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

Featured Command Candidates:

  • None so far… feel free to nominate one!

Featured Commands:

The ListPages module does not work recursively.

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.

(Read more...)

"Tokenization" is the process whereby the characters that make up a command are replaced by a token — a number representing the command.

(Read more...)

.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.