TI-Basic Programs/Chase

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Program Description[edit| edit source]

Chase is a simple yet enjoyable game. In it, players take the role of a "greater-than" symbol (>) who is getting to eat some X's. It is played on the regular typing screen, and there are 6 characters that can move around the screen. One is the player's character, the > sign. Another, the X, is the character that the player is supposed to move towards and eat once he has reached it. The other four, however, are "not-equal-to" symbols (≠) which are vicious and will try to eat the player if they get close enough. Chase has a title screen that draws itself up on the Graph screen through the CSTART program, which must also be on a player's calculator before he can play Chase. The title screen has four options which are:
1) New Game (to start a new game)
2) Continue (to continue a currently saved game)
3) Instructions (to bring up the instructions for Chase)
4) Quit (to leave the program and return to the main screen).

In the Instructions page, much of the above information is covered, as well as other information like which keys are used for the game controls. In the game, the five non-player characters (the four ≠'s and the X) move around on their own, randomly following any of four patterns. For instance, if one of the ≠'s moves a space left, then another will move up, another will move down, and another will move right. Two ≠'s will never move in the same direction as one another in one move. Also, the movement of the X will parallel that of one of the four monsters. The controls that the player uses to move are displayed on the Instructions page. The player can press any of the 9 number keys (1-9) except for the 5 to move his character. For instance, pressing the 7 key will move the player's character up one space and to the left one space, and pressing the 8 key will only move the player's character up one space. This explanation may be difficult to understand but is very easy to figure out by playing the game.

The player's score is displayed in the upper-right corner of the screen throughout the game. Whenever the player eats the X character, one point will be added to his score in the display. Also, the X will disappear and be regenerated somewhere else on the screen. The player's high score is displayed in the Chase title screen every time he starts the game.

One last control is the ENTER key, which pauses/saves the game that you are currently playing. If the player presses it once while he's playing, he can save his game and come back to it whenever he wishes by starting prgmCHASE and choosing option 2, Continue, mentioned above. Also, by pressing the ENTER key twice while playing, once to pause/save the game and then once again, He can resume immediately and play will continue. The effects of this are that all of the variables for things like score and position of each character on the screen are stored and also, the game will regain its regular running speed. Unfortunately, whenever one is running a TI-Basic program that repeats, it will eventually run slower and slower. To avoid or solve this problem when playing Chase, one can use this method of pressing ENTER twice. As stated above, this exits the program and then resumes it again.

Note: The variables used by the calculator to operate Chase are stored in the [J] matrix.

Program Code[edit| edit source]


  1. Many of these lines of code can be linked together in one line by just typing a ":" instead of pressing ENTER and typing the next command on the next line. Also, some of the commands displayed here are already linked in this way.
  2. The "¤" found in the command, " :Output(8,3,"-GAME¤SAVED- ", is actually a very small square and it can be found in the CATALOG menu on your calculator. It will be above what looks like a small plus sign (+), near the bottom of the list.
:If Ans=105:1→Y
:If 1=Y
:DelVar Y
:Goto A
:If 1≠[J](3,5
:If Ans=93
:Goto A
:DelVar X
:Lbl E
:If C<1:1→C:If C>8:8→C:If D<1:1→D:If D>16:16→D:If E<2:2→E:If E>7:7→E
:If F<2:2→F:If F>15:15→F:If G<2:2→G:If G>7:7→G:If H<2:2→H:If H>15:15→H
:If I<2:2→I:If I>7:7→I:If J<2:2→J:If J>15:15→J:If K<2:2→K:If K>7:7→K
:If L<2:2→L:If L>15:15→L:If M<2:2→M:If M>7:7→M:If N<2:2→N:If N>15:15→N
:If C=E and D=F or C=G and D=H or C=I and D=J or C=K and D=L or C=M and D=N
:Goto E
:Lbl C
:If E<2:2→E:If E>7:7→E:If F<2:2→F:If F>15:15→F
:If E=M and F=N
:Goto C
:Lbl A
:Disp X
:If C=E and D=F
:Goto C
:If C=G and D=H or C=I and D=J or C=K and D=L or C=M and D=N
:Goto D
:If Ans=105
:If Ans=0
:Goto B
:If Ans=72 and C>1 and D>1
:If Ans=73 and C>1
:If Ans=74 and C>1 and D<16
:If Ans=82 and D>1
:If Ans=84 and D<16
:If Ans=92 and C<8 and D>1
:If Ans=93 and C<8
:If Ans=94 and C<8 and D<16
:Lbl B
:If Ans=4
:Goto 3
:If Ans=3
:Goto 2
:If Ans=2
:Goto 1
:If F≥2 and G≤7 and J≤15 and K≥2 and N≥2
:Goto A
:Lbl 1
:If E≥2 and H≥2 and I≤7 and L≤15 and M≥2
:Goto A
:Lbl 2
:If F≤15 and G≥2 and J≥2 and K≤7 and N≤15
:Goto A
:Lbl 3
:If E≤7 and H≤15 and I≥2 and L≥2 and M≤7
:Goto A
:Lbl D
:Output(4,2,"YOU GOT EATEN!
:If X>[J](1,5
:Output(5,2,"{Press  enter}
:Output(4,2,"New high score:
:Output(5,2,"              "    <-- (This close-quote mark is not needed, but
:Output(5,8,[J](1,5                       there must be 14 blank spaces here)