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 Your Projects 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. Project Ideas/Start New Projects => Your Projects
Author Message
kermmartian
Site Admin Kemetech


Calc Guru


Joined: 20 Mar 2004
Posts: 1220

Posted: 13 Dec 2005 11:11:43 am    Post subject:

Am I the only one for whom this page is a lil screwed up?
And yeah, please use for/while/repeat instead of lbls. Smile
Back to top
Rhynomite


Member


Joined: 08 Oct 2005
Posts: 122

Posted: 13 Dec 2005 11:03:11 pm    Post subject:

Well, my avatar isn't showing up so I guess it's back to the Ice Climber whacking the seal.
As for the gotos, I suppose I'll try to remove as many as I can- and I don't move very quickly, so don't expect me to get much done soon.

I'm sorry for being such a horrible basic programmer. I know everyone else here at UTI would by now be releasing the project if they were making it.
Back to top
Radical Pi


Advanced Member


Joined: 23 Nov 2005
Posts: 455

Posted: 16 Dec 2005 10:14:21 am    Post subject:

kermmartian wrote:
And yeah, please use for/while/repeat instead of lbls. Smile
[post="64281"]<{POST_SNAPBACK}>[/post]

I think you should be able to Goto out of a loop to maintain engine speed, as long as you remember to Goto a Lbl right before the end, especially if you're only doing this under special conditions, like

Code:
While 1
If X>8 or X<1 or Y>16 or Y<1:Goto 1
Lbl 0
End
Lbl 1
If X>8:1->X
If X<1:8->X
If Y>16:1->Y
If Y<1:16->Y
Goto 0

You don't want to slow the game down with code that might not even be used, so put it in outside the loop.

EDIT:I didn't triple post before. Some posts were deleted it seems.


Last edited by Guest on 16 Dec 2005 10:23:10 am; edited 1 time in total
Back to top
thornahawk
μολών λαβέ


Active Member


Joined: 27 Mar 2005
Posts: 569

Posted: 16 Dec 2005 10:26:45 am    Post subject:

The arrangement


Code:
While 1
If condition
Goto 1
Lbl 0
End
Lbl 1
~statements~
Goto 0


is memory-leak prone, I'm afraid. Use status variables instead to break out of a While (or a Repeat, for that matter).

thornahawk
Back to top
Radical Pi


Advanced Member


Joined: 23 Nov 2005
Posts: 455

Posted: 16 Dec 2005 10:32:39 am    Post subject:

Wouldn't it be safe if you jump back into the loop?
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Dec 2005 02:41:48 pm    Post subject:

Right, I don't believe the previous code does cause memory leak, as [font="courier new"]End is encountered successfully regardless of the condition. Still, I insist that the loss of speed due to label searching makes the method moot.

This could work...
[font="courier new"]While 1
Repeat X>8 or X<1 or Y>16 or Y<1
End
If X>8:1→X
If X<1:8→X
If Y>16:1→Y
If Y<1:16→Y
End


...but I suggest that you try this one instead: Wink
[font="courier new"]While 1
X-8((X>Cool-not(X→X
Y-16((Y>16)-not(Y→Y
End


Last edited by Guest on 16 Dec 2005 02:43:52 pm; edited 1 time in total
Back to top
jvdthwip


Advanced Newbie


Joined: 21 Jun 2004
Posts: 93

Posted: 20 Dec 2005 09:02:53 am    Post subject:

I used SourceCoder to "optimize" one of my old basic programs (when I was new to the language), and it added 15 bytes... A negative compression ratio!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Dec 2005 10:35:16 am    Post subject:

I had that happen to me, although I didn't find where exactly it changed something. What's up with that?
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 Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement