This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Author Message
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 10:58:32 pm    Post subject:

I worked for a while on trying to get this to work, and now I finally have! This could be useful for storing information while making text based games, as the TI 83 only technically has variables A-Z and that O with the line through it. I use lists/matrices all the time to store data, and I hope that this will help some of you Smile

Random Lists:

Code:
randInt(1,6)-->A
For(B,1,A)
randInt(1,6)-->C
A-->dim(L1)
C-->L1(B)
End
Disp L1
"


NOTE:
-The values in the randInt() can be changed to make your list/values in the list either bigger or smaller.
-It displays List 1 at the end of the program, to show you what the value is.
-Of course, you can change the variables, just make sure they match up :P

Random Matrices:


Code:
randInt(1,6)-->A
randInt(1,6)-->B
For(C,1,A)
For(D,1,B)
randInt(1,6)-->E
{A,B}-->dim([A])
D-->[A](C,F)
End
End
[A]


NOTE:
-The values in the randInt() can be changed to make your list/values in the list either bigger or smaller.
-You CANNOT just put an 'A' in brackets. You have to go to the matrix section and select a matrix (in this case, matrix A)
-You can change the variables, just make sure they match up Very Happy
-It displays matrix A at the end of the program so you can see what it is :P


Hope this is useful to some people Very Happy Very Happy :D





AND





I've run into A LOT of people who are wondering how to make a timer instead of using the 'Pause" function. I've researched for a while and found out how :D

Timer:

Code:
0-->A
While A<300
A+1-->A
End


As you can see, this is very simple Very Happy. Just place this bit of code wherever you want to put a timer in, and it will work. You can change the value after the "A<" to make the timer shorter or longer (higher value is longer, lower value is shorter)

Hope this helps!


Last edited by Guest on 14 Nov 2009 11:31:55 pm; edited 1 time in total
Back to top
GloryMXE7
Puzzleman 3000


Active Member


Joined: 02 Nov 2008
Posts: 604

Posted: 14 Nov 2009 11:11:05 pm    Post subject:

or, to conserve ram, instead of this
dEvIoUs MiNd wrote:
Timer:

Code:
0-->A
While A<300
A+1-->A
End

you can use a for loop like this
for(A,0,300
End


the O with a slash is called Theta
and you can leave out end brackets and parentheses

a better random number generator
randM(randInt(1,6),randInt(1,6→[A]


Last edited by Guest on 14 Nov 2009 11:24:57 pm; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:12:22 pm    Post subject:

Welcome to UTI
Now for some optimization

You could do this for a timer

Code:
rand(#

the bigger the number the longer the pause


Code:
randInt(1,6)-->A
For(B,1,A)
randInt(1,6)-->C
A-->dim(L1)
C-L1(B)
End
Disp L1
"

becomes

Code:
randInt(1,6-->A
For(B,1,A
randInt(1,6-->C
A-->dim(L1
C-L1(B
End
Disp L1
"

leave of ending )
or

Code:
randint(1,6
randint(1,6,Ans->L1
Disp L1


or


Code:
randint(1,6),randint(1,6-->L1
Disp L1


or if you dont need a list you could use


Code:
randint(1,6),randint(1,6
Ans


Last edited by Guest on 15 Nov 2009 12:08:06 am; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 11:18:28 pm    Post subject:

Quote:
you can use a for loop like this
for(A,0,300
End


for some reason, i cannot get this to pause as long as the other one

EDIT: nvm, found out i just had to add a really big value in place of the '300' :P

EDIT: for the "rand(#" it gives me a random list? whaaat?

Quote:
randint(1,6,randint(1,6)-->L1
Disp L1


highest dim for the List that gives me is 3


Last edited by Guest on 14 Nov 2009 11:30:46 pm; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:36:22 pm    Post subject:

dEvIoUs MiNd wrote:
EDIT: for the "rand(#" it gives me a random list? whaaat?

somthing like
output(1,8,"bla
rand(8
Clrhome
should give you a small pause

Quote:
randint(1,6,randint(1,6)-->L1
Disp L1

dEvIoUs MiNd wrote:
highest dim for the List that gives me is 3


Rlly it gives my list of all lengths to 6
GloryMXE7 wrote:
randM(randInt(1,6),randInt(1,6→[A]

darn you beat me to the punch


Last edited by Guest on 14 Nov 2009 11:43:42 pm; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 11:41:15 pm    Post subject:

I really need to learn optimizing Razz. I've been helping one of my friends (who is a VERY good programmer) figure out some things like this, but now i must learn optimization and help him more! his games are like 50 pages on a computer o.O

and for some reason,


Code:
randM(randInt(1,6),randInt(1,6→[A]


gives me negative values inside the matrix


what punch?


Last edited by Guest on 14 Nov 2009 11:45:06 pm; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:45:29 pm    Post subject:

dEvIoUs MiNd wrote:
I really need to learn optimizing Razz. I've been helping one of my friends (who is a VERY good programmer) figure out some things like this, but now i must learn optimization and help him more! his games are like 50 pages on a computer o.O

and for some reason,


Code:
randM(randInt(1,6),randInt(1,6→[A]


gives me negative values inside the matrix

thats odd

Code:
Abs(randM(randInt(1,6),randInt(1,6→[A]

gives you all positive #
dEvIoUs MiNd wrote:
what punch?


i was trying to figure out this

Code:
randM(randInt(1,6),randInt(1,6→[A]

but he beat me 2 it


Last edited by Guest on 14 Nov 2009 11:47:29 pm; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 11:47:17 pm    Post subject:

wow my brain process failed there...did not remember there was an Abs( function
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:48:21 pm    Post subject:

Thats ok we all forget sometimes
and i just learned about randM(


Last edited by Guest on 14 Nov 2009 11:49:32 pm; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 11:49:49 pm    Post subject:

btw, is there any way to make the ON button not break a loop?

yeah man me too...

never noticed randM( until i looked in the catalog for it Razz


Last edited by Guest on 14 Nov 2009 11:52:25 pm; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:53:44 pm    Post subject:

Not in basic you can do it with ASM though
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 14 Nov 2009 11:56:01 pm    Post subject:

dang that sucks because i dont have a usb cable for my ti 83 :P

Another Side thing I'm doing:

trying to make 2 letters on different lines move at different speeds.
So far, I can only get one to move :(

(i didn't worry about optimizing yet lol)

Code:
For(A,1,16
For(B,1,16
Output(1,A,"B"
Output(2,B,"A"
For(C,1,50
End
ClrHome
End
ClrHome


only the A moves Sad
I've tried troubleshooting but can't lol


Last edited by Guest on 15 Nov 2009 12:14:23 am; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 14 Nov 2009 11:58:30 pm    Post subject:

neither do i but you relly shouldnot have to do that
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 12:16:36 am    Post subject:

i know lol just trying something hard Razz
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 15 Nov 2009 12:20:51 am    Post subject:

there are ways to freeze the calculator and "force" a ram clear
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 12:24:04 am    Post subject:

I'd be pretty mad if that happened lol
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 15 Nov 2009 12:26:04 am    Post subject:

dEvIoUs MiNd wrote:
dang that sucks because i dont have a usb cable for my ti 83 :P

Another Side thing I'm doing:

trying to make 2 letters on different lines move at different speeds.
So far, I can only get one to move :(

(i didn't worry about optimizing yet lol)

Code:
For(A,1,16
For(B,1,16
Output(1,A,"B"
Output(2,B,"A"
For(C,1,50
End
ClrHome
End
ClrHome


only the A moves Sad
I've tried troubleshooting but can't lol


When you put a For loop inside another For loop, they won't run at the same time. Instead, the inside loop will complete every time you run through the outside loop. Instead, what you could do is run a single loop, and have one letter move every 10 loops, and the other letter move every 15 loops.


Code:
:For(I,10,160)
:If not(fPart(I/10) and fPart(I/15))
:ClrHome
:Output(1,int(I/10),"B")
:Output(2,int(I/15),"A")
:End


Anyway, your code doesn't have the right amount of Ends. You need to add one more End to close the first loop.

Here's a site explaining how For loops work, which you might find helpful: http://tibasicdev.wikidot.com/for


Last edited by Guest on 15 Nov 2009 12:26:37 am; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 12:32:59 am    Post subject:

one problem with that code: it stops before the A gets to the end of the screen

Last edited by Guest on 15 Nov 2009 12:33:16 am; edited 1 time in total
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 15 Nov 2009 12:37:50 am    Post subject:

dEvIoUs MiNd wrote:
one problem with that code: it stops before the A gets to the end of the screen

That's easy to fix. Change int(I/10) to min(16,int(I/10)) and then make the for loop go to 240.

Anyway, that's not the point; there's a million ways you can interpret "making 2 letters on different lines move at different speeds". The idea is, you move both letters in one loop at different rates by moving one letter every X loops and moving another letter every Y loops, which determines their relative speed.


Last edited by Guest on 15 Nov 2009 12:42:41 am; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 12:46:48 am    Post subject:

can you give an explanation for those lines of code? i really don't understand what they mean, seeing as i have never used the fpart() function
Back to top
Display posts from previous:   
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
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are UTC - 5 Hours

 

Advertisement