Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Eeems on July 18, 2009, 10:01:59 pm

Title: Streaming Method (Celtic III)
Post by: Eeems on July 18, 2009, 10:01:59 pm
so the basics behind streaming is to take one line at a time from a program and run it. streaming is good for keeping a lot of ram free, because you don't need the whole program on it. what it gains in RAM saving it loses in speed though...due to it having to take from the archive and copy into the ram every line a major speed lose is created.
so to stream a piece of code you need to know how many lines there are in the code, so you can either install a simple check in the code to only run the line if it exists and if it doesn't to end. or you can add a check at the start of the code too see how many lines there are.
Code: [Select]
det(0,"ZZ",5 //create the program ZZ
det(5,"rowswap("+Str1,1  //copy the first line from the appvar named in Str1
det(6,"ZZ",Ans,1  //copy the first line into program ZZ
prgmZZ  //run program ZZ to get the answer in the first line
Ans->U  //store the amount of lines to run to the real U
det(0,"ZZ",4  //delete the program ZZ
For(V,1,U)  //loop for the amount of lines specified in the first line of the appvar
det(0,"ZZ",5  //create the program ZZ
det(5,"rowswap("+Str1,V+1  //get the line specified in the real V
det(6,"ZZ",Ans,1  //store the line to program ZZ
prgmZZ  //run the program ZZ to execute the code we just grabbed
det(0,"ZZ",4  //delete the program ZZ
End  //end the loop
now I know I could have used the errorhandle function to save time in the running, but then programmers could not troubleshoot while using this, and I can't seem to get it to work all the time....
Title: Re: Streaming Method (Celtic III)
Post by: Iambian on July 18, 2009, 10:33:47 pm
Quick note: The errorhandle function doesn't like to work for some odd reason. It's a bug that I've mentioned briefly on the UTI forums.
Title: Re: Streaming Method (Celtic III)
Post by: Eeems on July 18, 2009, 10:36:28 pm
yeah I know, that is why I don't use it...every once in a while it will work, but afterwords it wont
EDIT: here is a version that will use the indexing to it's full advatage
Code: [Select]
det(0,"ZZ",5 //create the program ZZ
det(23,"rowswap("+Str1,Ans  //create index
det(24,"rowswap("+Str1,Str1,1  //copy the first line from the appvar named in Str1
det(6,"ZZ",Ans,1  //copy the first line into program ZZ
prgmZZ  //run program ZZ to get the answer in the first line
Ans->U  //store the amount of lines to run to the real U
det(0,"ZZ",4  //delete the program ZZ
For(V,1,U)  //loop for the amount of lines specified in the first line of the appvar
det(0,"ZZ",5  //create the program ZZ
det(5,"rowswap("+Str1,Str1,V+1  //get the line specified in the real V
det(6,"ZZ",Ans,1  //store the line to program ZZ
prgmZZ  //run the program ZZ to execute the code we just grabbed
det(0,"ZZ",4  //delete the program ZZ
End  //end the loop
det(0,Str1,4  //delete the index
oh yeah and before I forget, I'm going to upload a version of celtic that will make this possible (the other ones have an error catch in the code)
also this version has fixed det(27
this version is complements of snjwffl.. I mean simplethinker

You got my messed up name wrong- simplethinker (aka snjwffl)
Title: Re: Streaming Method (Celtic III)
Post by: simplethinker on July 18, 2009, 11:35:40 pm
Do you need to delete the program every time?  Couldn't you just overwrite the line? (or is this just until LOOKUPINDEX strips newlines?)
Title: Re: Streaming Method (Celtic III)
Post by: Eeems on July 19, 2009, 05:58:02 pm
well I could just replace it, but or some reason it doesn't always work for me, and I could add in the sub(Ans,2,length(Ans)-1 to it to strip teh newlines.
Title: Re: Streaming Method (Celtic III)
Post by: Geekboy1011 on July 20, 2009, 12:04:29 pm
hmm i might actually be able to use this for crimson and the sceenies look great definetily have to figure out how this works :)
Title: Re: Streaming Method (Celtic III)
Post by: Eeems on July 20, 2009, 06:23:34 pm
lol, thanks. If you want I can make an engine for you to use, it will just take a little modification of what is above to make work. I'll make full documentation and everything
Title: Re: Streaming Method (Celtic III)
Post by: Geekboy1011 on July 20, 2009, 06:25:19 pm
hmm i might ask that i need to finish a few things fist so ill let u know :)
Title: Re: Streaming Method (Celtic III)
Post by: Eeems on July 20, 2009, 06:38:45 pm
kk, no problem
I've already got it mostly built because I will be using something almost the same for my game