Edit by Kerm: Until you get slightly better, I'm going to leave this as a working topic for yourself. We should probably all work together to come up with some foolproof sample code, or we could also probably use a few snippets from my book, since the source code for all my demos gets publicly released.


Edit by Aes. I agree completely, I am going to test all the code now, and over the next day or 2. As well as come up with a full sprite controlled menu. I gladly accept any input you have, including the snippets from your book, this is for all to learn and put into, not just me Very Happy


Here is where you come if you want to learn programming, from looking at programs. These will be to the point, without having to look through a bunch of stuff that does not make sense.

This is a work in progress, before I begin, if you have a better title, please post it here or PM me.

If you have code that would like to be added, feel free to post here. I will edit the main post with the added code.

*CAUTION* These are semi difficult programming technics. A basic understanding of Ti Basic is recommended before you try these techniques.

Feel free to go to Pastebin.com At any time to see all these programs and download them. They will be named according to what they do and there progression. So menu1, menu2 etc.

Username: Ti_Basic_Tutorials
Password: cemetech

Please do NOT add pastes, as I will delete them. If I catch this a lot, I will change the password and/or delete the account and do this the hard way.

Basic Menu's
Basic Menus without using the Menu( Commands.

Basic Menu

This is the basic outline of many begginers programs. You have the Menu( Function, with labels going all the way through your program. Labels have there place, but they are not very good programming technique.

Basic Menu Fixed

Text Menu using getKey

Note: The program above can use Text( , Output( , or Disp for the menu options. I personally prefer Text( Because it has more options, you can get many things in that line of text, and it has smaller font so you can fit more. When it comes to the final product, if you are happy with it, and it looks good, that is all that matters.

This menu can also be made to work on a sprite based system. Meaning that it looks like a gui controlled menu. Without the mouse pointer. You can recreate the system menus using this method, making your program look more professional.


Before we are able to do that however, you have to have a decent understanding of boolean algebra.


Boolean Algebra

Boolean Algebra Sample

Basic Sprite Control

Basic Sprite Control

A little more advanced Sprite work, This erases the sprite as it goes, preventing problems such as the column turning black. Not so much of a problem now, but it will be later on.

Medium Advanced Sprite Control

Basic Sprite Control1

*****************************

1.Next in line, sprite control with vertical, and horizontal control,
2.Menu using the sprite

********************************
This is a work in progress. Will finish my few programs later. Please leave comments and complaints.

If anyone could come up with code for collision detection, that would be cool. Just something simple please. I am not sure how to do it myself, and it will be coming up soon in the progression.
I urge you to master the art of testing your own code before submitting it to students. Looking at the second code box, if Ans equals either 92 or 93, then the Pause will change the data type and cause the next condition to crash with an error.
Will this work?

Code:
 
Delvar KRepeat K=94. //both can be used, use what feels right for you.
Disp "TEST PROGRAM
Disp "1.SHOW A
Disp "2.SHOW B
Disp "3.EXIT
Repeat Ans
getKey
End
Ans→K
/////////////////////
//the user will push "1" (getkey code 92) or "2" (getKey value 93) To 
//pick the menu option they want
//Repeat is best used here, because as long as Ans = 0 (No key pressed) 
//Then the loop will continue.
////////////////////

If Ans= 92
//Key press of 1
Pause "A"
If K=93 
//Key Press of 2
Pause "B"
End
//This will loop until the user breaks the program or 3 is pressed because 
//the Repeat 0 or While 1 at the top makes it an infinite loop
Yes, but 1) there's no reason to delete K because Repeat doesn't check the condition when the loop is entered, and 2) I'd like to understand why you pulled →K out of the inner loop.
Is that wrong?
Yea sorry weregoose. Will edit that in a bit. I copied that from some code I used to teach someone else, and it worked fine.. Dont know why, but I will change that.

Other than that one problem, how does the rest look?
In your "boolean algebra" section, the single line does not mirror the outputs of the original block, since if B equals 3, then you should be adding 7 to B, not to A. Tabulating the results between both programs would have caught this. Now, I'm going to harp on you for it—I've said it oftentimes in IRC such that it should have set in by now—that you're neglecting to really put to trial much of what you set before us. Instead, we're beset with any of a wide range of errors, including transcription ones that have to be immediately clarified.

Hofstadter wrote that intelligence is based on the ability to draw distinction. In writing code, if you haven't made it good practice to test for differences between what the code does and what you hope it does, then be prepared for contradictions to arise when you start presenting it to others. If it's a contest of assertiveness of conduct rather than what ought to transpire, then the code will always win out over its programmer.
I need to stop coding on fridays, I always make stupid mistakes on fridays. I will pull the code, test it tomorrow. Tonight my brain is so shot I cant even think straight.

Thanks weregoose. And blue, to answer your question.

Repeat Ans
getKey->K
End

works the same, and saves 3 bytes.
I would like comments on the formatting. Does it look good? Anything to change? I am thinking about adding astericks on the categories (The bigger font with underlines) just to set it apart a little more. What do you all think?
  
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 1
» 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