Tomorrow I have to do a demonstrative speech demonstrating how to do something. I chose TI-BASIC as my topic. My plan is to write the source code to a little program I made today on the board and explaining the functions on each line. I think I have made things easy to understand. What do you guys think of my speech?

Speech Plan wrote:
Demonstrative Speech on Ti-83/84 Plus BASIC Programming
If you’ve never done any programming, then TI-BASIC is a good language to start with. It is very easy to learn. By the end of this speech, you will have learned what you need to know to make a game on your calculator.
First off, you need to start a new program. To do that, press the [PRGM] button, press the left arrow, and press enter. Now you have to name your program. You can name it anything you want. It helps to give it a name that is descriptive of what it does. We will name our program CATCHX. To type, press [ALPHA] and a letter, or [2nd] then [ALPHA] to type a lot of letters, then [ALPHA] again to stop. You should see a flashing cursor next to a colon. This is a line where you write commands, and you press [ENTER] to get a new line. The first thing you will want to do is clear the screen. Press [PRGM], right, then 8 to get the ClrHome function. Press [ENTER] for a new line. Most games have a title screen, and we will use the Output( function to display text on screen. Press [PRGM], right, and 6. The first thing you do is put the y value, or the vertical location. The screen has 8 rows and 16 columns. Next, put a comma and then put the x value, or the horizontal location. Last, put another comma, quotation marks [ALPHA][+] and the text.
:ClrHome
:Output(3,3,"CATCH THE X
:Output(4,5,"MADE BY
:Output(5,1,"ROBERTO SANCHEZ
We can use the Pause function, [PRGM][8], to pause the program until the user presses enter. You will want to store to values in a program. You select a value depending on your data type, press [STO >], and type in your variable. We will worry only about strings and numbers. To store to a string, type a quotation mark, the text, sto, and [VARS], 7 for a string. Loops are used to repeat lines of code, and three kinds of loops will be used in this program. Our first loop will keep playing the game until the user wants to quit. It is a while loop [PRGM][5], and executes code while a condition is true. While the user wants to play, the code for the game will repeat.
:Pause
:"Y→Str2
:While Str2="Y"
We will clear the screen again. Next we will store the (y,x) location of the user character at variables (A,B), the (y,x) location of the “x” at (C,D), and the values to change the user character’s location at E for A and F for E.
:ClrHome
:1→A
:1→B
:randInt(4,8→C
:randInt(4,16→D
:1→E
:1→F
You get randInt by pressing [MATH][left][5]. It gets a random number from a lower limit, the first number, to an upper limit, the second number. You can use the Input [PRGM][right][ENTER] function to get user input. First enter a question in quotations, a comma, and the variable to store into. We will store a name into a string.
:Input "NAME? ",Str1
Most games have some sort of limit, like a time limit. A for loop [PRGM][5] can do this. First enter the variable to be change, then the start, and last the end. The loop will increment the variable by 1 when it reaches the end of the code block, and repeat the code until the upper limit is met.
:For(G,1,360
Next, clear the screen. You would want to output the time left, and you can output it in seconds by dividing by 6, since 360 divided by 6 equals 60. You can see the program has a minute time limit. You only want to show a whole number though, not the decimals. To do that, press [MATH][right][5] and type G/6. Then we output the user character, theta [ALPHA][3] to the locations stored in the location variables. We also output the “x” at the location variables.
:ClrHome
:Output(1,15,iPart(G/6
:Output(A,B,"θ
:Output(C,D,"X
The getKey function [PRGM][right][7] checks for a key press and returns the value pressed. If no key is pressed, 0 is returned. You store the value to a variable. The only key values we will worry about are left, right, up, and down. Left is 24, Up is 25, Right is 26, and Down is 34. We will then adjust the values that change the location of the user-character using the code of the key pressed, however, since the values can’t be more than 1 or less than –1, we will check those too.
:getKey→H
:E-((H=25)-(H=34→E
:F-((H=24)-(H=26→F
:E-((E=2)-(E={-}2→E
:F-((F=2)-(F={-}2→F
The reason this works is explained by Boolean logic. Basically, if you have E=2 and E does equal two, it returns 1 for true. If E does not equal two, it returns 0 for false. For example, in the first line after getKey, if the key pressed was Up, it would decrement E by one and if Down was pressed, it would add one because subtracting a negative is addition. Now we have to update the locations by adding E and F.
:A+E→A
:B+F→B
Since there are 8 rows and 16 columns, if, for example, the row variable was 9, you will get an error. Because of that, we must also check for this.
:A-8((A=9)-(A=0→A
:B-16((B=17)-(B=0→B
Now we check to see if the user caught the x. If x was caught, a series of commands must be executed. To set aside these commands, we use an If [PRGM][1] Then [2] statement. If the condition is true, then it executes the code block. If the user caught the x, the user scores a point and the x has to be moved to another random location. Now that we are reaching the end of code blocks, we have to end [PRGM][7] them. We will put one end after If Then and another one right after to end the for loop that controls the time limit:
:If A=C and B=D
:Then
:randInt(1,8→C
:randInt(1,16→D
:I+1→I
:End
:End
That is the end of the game code. After the game ends, we clear the screen and show the user how many points were earned. After that, clear the screen again. :ClrHome
:Disp Str1,"SCORED",I
:Pause "POINTS
:ClrHome
Now you ask the user if they want to play again. There’s no guarantee they will return the correct answer though, so we will repeat the code until the user enters the desired value by using a Repeat loop [PRGM][6]. The code will repeat until either Y or N is entered.
:Repeat Str2="Y" or Str2="N"
:Input "PLAY AGAIN?(Y/N)",Str2
:End
We must add a final end to enclose the while code block that decided if you play again or not. If the user doesn’t want to play again, the game ends. You must delete all the variables that were used so that you don’t waste memory. After that, add a quotation mark to finish.
:End
:DelVar ADelVar BDelVar CDelVar DDelVar EDelVar FDelVar GDelVar HDelVar IDelVar Str1DelVar Str2"
That is the entire code for the program. If you learn from this code, you can use the concepts learned to make other programs. Once you become proficient with BASIC, you can learn other calculator languages that are far more powerful and allow you to make better games like Phoenix. For more tutorials and information, visit the following sites:

www.ticalc.org
Www.ticalc.org/archives/files/authors/95/9542.html
http://tifreakware.calcgames.org/tutorials.htm


Here is the code to the program I will use as a demonstration:


Code:
PROGRAM:CATCHX
:ClrHome
:Output(3,3,"CATCH THE X
:Output(4,5,"MADE BY
:Output(5,1,"ROBERTO SANCHEZ
:Pause
:"Y→Str2
:While Str2="Y"
:ClrHome
:1→A
:1→B
:randInt(4,8→C
:randInt(4,16→D
:1→E
:1→F
:Input "NAME? ",Str1
:For(G,1,360
:ClrHome
:Output(1,15,iPart(G/6
:Output(A,B,"θ
:Output(C,D,"X
:getKey→H
:E-((H=25)-(H=34→E
:F-((H=24)-(H=26→F
:E-((E=2)-(E={-}2→E
:F-((F=2)-(F={-}2→F
:A+E→A
:B+F→B
:A-8((A=9)-(A=0→A
:B-16((B=17)-(B=0→B
:If A=C and B=D
:Then
:randInt(1,8→C
:randInt(1,16→D
:I+1→I
:End
:End
:ClrHome
:Disp Str1,"SCORED",I
:Pause "POINTS
:ClrHome
:Repeat Str2="Y" or Str2="N"
:Input "PLAY AGAIN?(Y/N)",Str2
:End
:End
:DelVar ADelVar BDelVar CDelVar DDelVar EDelVar FDelVar GDelVar HDelVar IDelVar Str1DelVar Str2"
Generated by SourceCoder (http://www.cemetech.net/projects/basicelite/sourcecoder.php)
© 2005 Cemetech (http://www.cemetech.net)
not too bad, I hope it goes well (too bad I couldn't do a presentation on this at my school)
thats a cool idea. Will everyone have calculators?
I would see if you could borrow a Viewscreen when you do this also, make it easier for people to see what you are doining
Yes a view screen is a good idea. I'll see if I can get one on such short notice.

@Rivereye: If your school has a Speech and Debate class, get in the class. That will give you the opportunity to do this kind of presentation.

@Elfprince: Hopefully they will. Most of the class are sophomores in Algebra 2 or higher, so I bet they would have an 83+. I know a lot of them are in my third hour Alg 2 so they would have a calc on them.
Plz2Mention Cemetech as well? Smile
KermMartian wrote:
Plz2Mention Cemetech as well? Smile


How in the world would he work in Cemetech (or any calc site) in a Ti-Basic tutorial?!?!
Kllrnohj wrote:
KermMartian wrote:
Plz2Mention Cemetech as well? Smile


How in the world would he work in Cemetech (or any calc site) in a Ti-Basic tutorial?!?!

Something1990 wrote:
KermMartian wrote:
Kllrnohj wrote:
KermMartian wrote:
Plz2Mention Cemetech as well? Smile


How in the world would he work in Cemetech (or any calc site) in a Ti-Basic tutorial?!?!

Something1990 wrote:


ah, missed that part (although I'm not sure I would include URLs in a speech/presentation - are they supposed to write those down or something? Laughing )
Laughing I assume he's going to distribute some kind of written handout?
woohoo!! Very Happy
Heh, I can't wait to hear how this turns out. The response should be interesting...
It didn't work out so well. I ran out of time Sad I only got to this part:

Speech wrote:
We will clear the screen again. Next we will store the (y,x) location of the user character at variables (A,B), the (y,x) location of the “x” at (C,D), and the values to change the user character’s location at E for A and F for E.
:ClrHome
:1→A
:1→B
:randInt(4,8→C
:randInt(4,16→D
:1→E
:1→F


Don't worry tifreak. I had enough time at the end to quickly write the address on the board. Wink I think the whole class was lost. There was only one other person there that supposedly had some programming knowledge, but the look on his face was the same as others in the class. At least I didn't do my speech on dumb things like pool games or Clue. Laughing
Don't feel bad. It takes different times for people to learn programming. Also, Ti-Basic should be more hands on. It makes it a bit more fun.
I would have suggested that instead of saying [MATH][LEFT][5] you use something to the effect of The randint function can be called to a program by going to the MATH Menu, scrolling to the PRB submenu, and selecting the "RandInt(" command, then giving the key sequence. Also, you generally don't want to introduce optimization tricks like deleting end parentheses, etc. I know how hard it is to teach programming, believe me. Sounds like you did a fairly good job on your presentation.
So was it rated or scored in some way?
We get a grade for our speeches. I should find out what my grade is by this Friday.
[offtopic]Am I the only one who thinks Liazon's new avatar/sig look incredibly evil?[/offtopic]
jpez wrote:
[offtopic]Am I the only one who thinks Liazon's new avatar/sig look incredibly evil?[/offtopic]

[offtopic]Actually, I kinda like it.[/offtopic]

If I were giving that speech, I probably would have made it ever so slightly less specific for an intro to programming. Smile
yeah, probably

[offtopic]I like it also, I need get some more avatars to have[/offtopic]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement