Hello fellow people
I am trying to figure out have to make the screen not redraw it's self so that it doesn't mess with the eyes
Warning:Code is still in development if I figure this out before you do don't be mad I'm sry. Code is also incomplete
Note G is like a section of the map
Code:
…
While 1
Output(Y,X,"X")
getKey stored into I
If I=24
Then
X-1 stored into X
ClrHome
End
If I=34
Then
Y+1 stored into Y
ClrHome
End
…
If G=1
Then
Clrhome
Output(1,1,"T")
…
End
If G=2
Then
Clrhome
Output(1,1,"0")
…
End
…
End
Question:How do you make it to where it won't redraw itself over and over again
If you don't want the whole screen to re-draw itself, move the code for the elements you don't want re-drawn outside of your game loop. That way, all parts that are drawn/re-drawn will be the only parts that will be updated for each iteration of the loop. I hope this helps, and welcome to the TI-Basic Developer, Misfire!
I am sorry to tell you that this does not help. The game has repeatedly check the map for what area it's in. What I tried to say was that it wouldn't do that until it moved right in to G2 and then it started redrawing it's self over and over again. But thx anyway :) I very much appreciate it!
Nevermind I fixed the problem with some of this and some of that thx for all the help :)
I'm glad you solved it "kind of". Maybe post your idea on one of the project pages. I wrote some code that's very similar to yours for a drawing program since the pen command can't be executed from a program. My solution to this would be:
If I=24 or I=25 or I=26 or I=34
Output(Y,X," ")
If I=24
X-1
If I=34
Y-1
Output(Y,X,"X")
// Same stuff for I=25,26 with Y-1 and X+1 respectively
I don't know if something like that would work for what you are doing, but I'm eager to help. Feel free to send me message about this or anything else for that matter.
4920616D204261746D616E
That code could even be more simplified:
Output(Y,X," "
X-(I=24)+(I=26)→X
Y-(I=26)+(I=34)→Y
Output(Y,X," X"
That's really good, I might change what you have and add it to my pen tool. I haven't learned about optimizations and algorithms yet. Could you recommend a book on that?
4920616D204261746D616E
I can't think of a good algorithms and/or optimizations book off the top of my head, but I can recommend checking out the TI-BD page on it. A lot of general tips for saving a few bytes or seconds.
The trouble with books on conventional algorithms is that TI-Basic simply doesn't have many of the capabilities that make algorithms efficient on regular computers. Optimization is very tricky and very specific to TI-Basic, and a lot comes with practice. Take for example the obscure optimization for generating a list of integers from 0 to N:
:seq(K,K,0,N --> cumSum(not(binompdf(N,0
The alternative is faster than using seq( for the task, and is an optimization purely dependent on the fact that TI-Basic isn't very good at creating lists (in contrast to almost every high-level coding language). Optimization of algorithms is usually dealing with making an algorithm faster, but for TI-Basic the task involves speed and size.
This isn't to say some reading on the subject wouldn't be useful; if anything it is a fun task to try to convert an algorithm to TI-Basic.
The solution to a complex problem is often a simple answer.
There's not really a book that I know of. Most of it is learned through experience and actually doing the optimizations. If you want to learn how to optimize quickly, I would take a look at the Optimize me section of the forums and look though the threads to see how people optimized bits of code