Codes, Anyone?
Again, another nice topic to bring up. This should probably be devoted to BASIC code, though. But yeah, I remember when I was just starting out, I had to hunt for codes, so it will be nice to have a compilation of codes in one spot.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
So, here is my version of Rock, Paper, Scissors… I love patterns… And math functions! I think it can be optimised though…
prgmRPS……..234 bytes
1→B
ClrHome
Disp " ROCK"," PAPER"," SCISSORS
Repeat A=105
Output(B,1,"}
Repeat A
getKey→A
End
Output(B,1," ;There is a space there
B+(A=34)-(A=25
If Ans>3 or not(Ans
1+2not(Ans
Ans→B
End
B-1→B
randInt(0,2→A
"WIN!
If B=3fPart((A+2)/3
"LOSE.
If B=A
"TIE.
ClrHome
Disp Ans,"CALC:","YOU:
A
For(A,0,1
Output(A+2,6,sub("ROCKPAPERSCISSORS",5 nCr Ans,Ans²+4
B
End
I had fun with the last bit :D
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Anybody know the Internet meme "Herp-a-derp"?
Tom R.
Blacksmith, woodsman, patriot, and programmer.
Question: What compelled you to post that here? Lol.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Yeah… it seems rather insulting….?
Z80 Assembly>English>TI-BASIC>Python>French>C>0
I don't think it was aimed at you. If you look, it's a reply to the first post by ChrisAWJB, not a reply to yours lol.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Oh, yeah, I know :) It just seems like the phrase is something insulting.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
It kind of is, but this lock the calc until you press enter. Look on urbandictionary.com for more info.
Tom R.
Blacksmith, woodsman, patriot, and programmer.
I have a funny program that really doesn't need the code. Basically it's:
Menu("Herp or Derp?","Herp",1,"Derp",2
Lbl 1
Disp "HERPHERPHERPHERP
Goto 1
Lbl 2
Disp "Derpderpderpderp
Goto 2
Now, exactly how dangerous is a Lbl/Goto loop?
Tom R.
Blacksmith, woodsman, patriot, and programmer.
Not very. All you have to do is hit ON to break it. It causes no memory leaks, so it's all cool bro. (Lol)
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
N
I knew sumthin wasn't right :P oh well. It is great watching people's reactions.
Tom R.
Blacksmith, woodsman, patriot, and programmer.
If you want to exit it without pressing on, just add getKey→K right after each label, then a check for the exit key. Einfache :P (simple)
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Another method you can use is:
Repeat getKey=45 ;45 is clear
<<code>>
End
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Or
While getKey≠45
<<code>>
End
:P
Let's put it this way, there are many ways to go about doing this lol.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
It's not dangerous at all. The way you have it will work fine :)
Z80 Assembly>English>TI-BASIC>Python>French>C>0
I have a rock paper scissors program that works well. Needs to be optimized though.
Menu("Choose Weapon:","Rock",1,"Paper",2,"Scissors",3
(rand*100)→N
Lbl 1
If N≤(33+1/3
Then
Disp "Tie!
End
Goto 0
If N>(33+1/3) and N≤(66+2/3
Then
Disp "Calc Win!
End
Goto 0
If N>(66+2/3
Then
Disp "You Win!
End
Goto 0
Lbl 2
If N≤(33+1/3
Then
Disp "You Win!
End
Goto 0
If N>(33+1/3) and N≤(66+2/3
Then
Disp "Tie!
End
Goto 0
If N>(66+2/3
Then
Disp "Calc Win!
End
Goto 0
Lbl 3
If N≤(33+1/3
Then
Disp "Calc Win!
End
Goto 0
If N>(33+1/3) and N≤(66+2/3
Then
Disp "You Win!
End
Goto 0
If N>(66+2/3
Then
Disp "Tie!
End
Goto 0
Lbl 0
Tom R.
Blacksmith, woodsman, patriot, and programmer.
Yes! This is fun! I love optimising things! I can have fun with this, right!?!? I'll just optimise, I won't actually change the idea of it… Then if I can, I'll post my version (if it is any smaller :P )
Z80 Assembly>English>TI-BASIC>Python>French>C>0
I don't see why not.
Tom R.
Blacksmith, woodsman, patriot, and programmer.
So, for optimisations, I see off the bat that you can do 100rand→N. The calc handles implied multiplication unlike many programming languages, so that is just something neat about TI-BASIC. Erm, instead of doing "(33+1/3" you can do 100/3. you can do 200/3 instead of 66+2/3, too. Umm, but otherwise, as a tip randInt(0,2→N will store a random integer from 0 to 2 (so 0, 1, or 2) to N. That might be easier than using rand ;D
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Um just wondering, but wouldn't changing all the
If ...
Then
....
End
blocks to
If... : ...
save a ton of space?
Oh, yeah, I only glanced at it and the math popped out at me. Yeah, as long as there is one thing in an If block, you do not need a Then or End. It is just one of those things that TI added for optimization purposes. Just remember that: as much as people in the community like to bad mouth TI, TI did do a LOT of work (and they are programmers too :P )
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Yeah, as long as you only have 1 action from the If statement, it's better to leave off the Then and End.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
If you have something like:
If A=1
Then
Goto A
End
It will cause a mem leak, right?
Will this:
If A=1:Goto A
cause a leak?
The first code will cause a memory leak, yes; because it does not reach the End and therefore the memory stack for that conditional is not reset. The second one, of which I am 99.9% sure of, will not cause a memory leak because there is no stack created by the Then command.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Ok thanks. Another question: will garbage collecting reset the stack?
No, garbage collecting occurs to kind of scrunch up the archive. When you delete or uunarchive a var, the data stays and the next archive is placed after it. So pretty much, there are gaps in the archive that become unused every time you unarchive or delete an archived var. GarbageCollect moves all of the archived data back together so that you have access to all of your memory again without giant chunks of of wasted memory. This is all done to protect your Flash memory as it can only be used so many times :D
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Yeah, just like old Game Boy Color games won't save anymore after a while.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Um… When does that happen? What are the signs? How do you prevent this?
I hope my calc does not die.
Here, I'll answer your questions in order:
1- After roughly 8-10 years
2- Um… Really no noticeable signs, other than a bit of lag maybe
3- Really no way to prevent it
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
To add on to what Xeda said, what she means by the "data staying" is that the calculator doesn't actually delete it, it just marks it for deletion (or archiving, whatever you're doing) and moves it. GarbageCollecting is pretty much like defragging your hard disc on your computer: you uninstall a program which leaves a gap and if you install a program that was larger than that uninstalled program, part of it goes in to fill up that space and part of it gets moved somewhere else.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Yep, but because the processor on the calc isn't as fast as a computers (and files are almost never that large), instead of splitting up the data, if it is too big, it just copies it elsewhere. Um, usually the flash chips can take about 10000 writes, so it takes a while. If you are like me and you want to really conserve the chip, there are programs that copy the data to RAM instead of unarchiving (I have made such programs, too). This means the flash chip is preserved with no writing, just reading.
Erm, I'm getting a little technical… sorry.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Can you recomend any programs that do that?
Erm, I have an APP if you want that. If you want an actual opcode, I might be able to whip something up… but I don't know how quick.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Well you siad you were working on the data base so I would not want to bother you. Just send me the link to the app. Thanks.
On second thought, if it is not to much trouble, could the prgm2str converter that you gave me be modified to copy from archive? ( I already have a str2prg converter)
Okee, here are the downloads:
BatLib
ReadMe
You can also check this topic on TIBD:
SpriteLib (now known as BatLib)
So for reading vars from the archive, use command 21. So to read a program (it gets stored as a string :P):
sum(21,"NAME",5
Name does not include "prgm" for programs. For strings or what not, the 5 is not needed. For pictures, MultiPics is included, so you can recall your pics from archive. For lists, use SubList to read lists from archive (Even parts of the list, hence the "Sub" part). There are a bajillion commands to work with, so have fun :D
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Okay, so if someone needs something to do, I have a challenge. What I need (for a friend of mine) is to:
A: have the ability to automatically make inverses of graphs
B: put in as many (up to ten…duh) graphs as he wants
C:be able to chose between graphing the inverse or not.
Time limit: forever.
Speed can be a factor, but it doesn't have to be, but space is a huge factor. Whoever comes up with the best gets 2 internets and a cookie.
Tom R.
Blacksmith, woodsman, patriot, and programmer.
You mean like flipping the axes?
*Zeda singing "All you need is math" to the tune of "All you need is love"
This usually doesn't show up until calculus, i think, but Parametric equations let you use X, Y, and T.
-Change your mode to Parametric
-Go to Y=
-Enter the equation in X1t
-Enter "T" in Y1t
-Go to Window
-Enter -2pi for Tmin
-Press Graph
Method 2 does not require you to do math:
-[2nd][prgm]
-[8]
-Enter equation OR you can just do something like DrawInv Y1
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Well,, kind of. But he wants it to graph the things all at once, without doing DrawInv Y1 or all that jazz. Du hast mich gefragt, und ich hab nichst getsagt. NIt sure if that's all correct though.
Tom R.
Blacksmith, woodsman, patriot, and programmer.
You could make a BASIC program to just use this method on all the Y-vars… It's a ridiculously long process to make line routines in assembly. Once I figure it out, I plan to make graphing programs, anyway. I remember when I made a program called prgmGRAPHXY. It was in BASIC and let you input equations with a menu similar to the TI-OS one and it graphed equations either inverted or normal and it had a table, window, and trace menu.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
This (your German), I'm guessing, is from Rammstein? It's "Du hast mich gefragt, und ich hab nichts gesagt" which basically means "You have asked me, but I did not reply."
To graph all equations at once, instead of SEQUENTIAL, change your mode to SIMUL.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
I still like the parametric mode idea, too. All you do is put the equation in X1, put T in Y1, and change Tmin to -2pi. It is pretty useful :D. And then putting it in SIMUL will let you graph it all at once.
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Here's a cool one. Set to Polar Mode, radians, then do sin(cos(tan(θ
Tom R.
Blacksmith, woodsman, patriot, and programmer.
and set viewing window to -1 and 1 for x and y
Tom R.
Blacksmith, woodsman, patriot, and programmer.
I used these in an old RPG once. I found these notes lying around:
T represents theta
Xmin=-pi/2
Xmax=pi/2
Ymin=-62pi/188
Ymax=62pi/188
I'll probably multiply the limits by 2 for the game
================================================================
Bufli sin(sin(tan(T
Magfly sin(cos(tan(T
Attack Master sin(tan(tan(T
Wataray cos(sin(tan(T
--- cos(cos(tan(T
Maxpider cos(tan(tan(T
Bufli (big) tan(sin(tan(T
Magfly (big) tan(cos(tan(T
Los-Wei tan(tan(tan(T
Eye sin(T+sin(T+sin(T
--- sin(T+sin(T+cos(T
Psyita sin(T+sin(T+tan(T
--- sin(T+cos(T+sin(T
--- sin(T+cos(T+cos(T
Shalka sin(T+cos(T+tan(T
??? sin(T+tan(T+sin(T
Healer sin(T+tan(T+cos(T
Sabem sin(T+tan(T+tan(T
--- cos(T+sin(T+sin(T
--- cos(T+sin(T+cos(T
??? cos(T+sin(T+tan(T
--- cos(T+cos(T+sin(T
Side Eye cos(T+cos(T+cos(T
??? cos(T+cos(T+tan(T
??? cos(T+tan(T+sin(T
Water Demon cos(T+tan(T+cos(T
??? cos(T+tan(T+tan(T
--- tan(T+sin(T+sin(T
--- tan(T+sin(T+cos(T
--- tan(T+sin(T+tan(T
--- tan(T+cos(T+sin(T
--- tan(T+cos(T+cos(T
??? tan(T+cos(T+tan(T
??? tan(T+tan(T+sin(T
??? tan(T+tan(T+cos(T
??? tan(T+tan(T+tan(T
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Er, what? Are you referencing a game or a monster?
Z80 Assembly>English>TI-BASIC>Python>French>C>0
I think he's asking about the name of the RPG lol.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
Oh, I never released the program (it was before I had internet).
Z80 Assembly>English>TI-BASIC>Python>French>C>0
All right I was just wondering because most of the names in the coding were similar if not the same as some names from Dragon Warrior Monsters, and I was wondering if you had possibly modeled that game off of it or if it were coincidence. I guess it was coincidence
Ah, okay. Yeah, about the only exposure I had to the outside world came from either school or books. :D I didn't even know what an RPG was back when I made that (seriously, a friend of mine was playing and they told me "Oh! So this is an RPG?" and I just stood there and asked what an RPG was).
I guess it is either a sign that creativity is limited or people tend to have similar imaginations :D
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Just noticed Maxpider… Clever lol.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
I liked it; It's one of my favorites. A lot of the names came after I saw the graph of the equation. Like Wataray looked like a stingray, Bufli and Magfly looked like bugs, and Water Demon looked like something you would find in the ocean. I used to have one that looked like a Pac Man that I used for spriteless monsters. Unfortunately I cannot remember the equation D:
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Alright, so, I was looking through my groups on my calculator and found this little bit. I believe it was originally written by weregoose, but I added support for the down key and changed 0→_ to DelVar (whoopee…).
::"Bouncy!
:ClrHome:ClrDraw
:DelVar UDelVar VDelVar ADelVar B3→M
:AxesOff:ZStandard
:Repeat K=45
:getKey→K
:U+.1((K=26)-(K=24→U
:V-.04+.15((K=25)-(K=34→V
:If 10<abs(A+U
:-.7U→U
:If B+V<-10 or B+V>10
:-.7V→V
:A+U→A
:B+V→B
:Pt-On(A,B
:End
:ClrDraw:ClrHome
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future