The Complete BASIC Optimization Guide
Posted by Michael on 12 July 2006, 04:47 GMT
Arthur O'Dwyer has recently updated his classic TI-83 BASIC programming optimization guide, The Complete TI-83 Basic Optimization Guide. Version 2 features a wealth of new information regarding all facets of BASIC optimization. After perusing through this latest version for this news article, I would highly recommend it to all serious BASIC programmers. It is certain to mention an optimization trick that you've never thought of.
|
|
Reply to this article
|
The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.
|
|
Re: The Complete BASIC Optimization Guide
|
burntfuse
(Web Page)
|
I'm an assembly programmer (and a sort of inactive one at the moment), but these BASIC optimization guides are still interesting to read, and I hope to see these techniques in many new programs.
|
Reply to this comment
|
12 July 2006, 22:04 GMT
|
|
Re: The Complete BASIC Optimization Guide
|
tifreak8x
(Web Page)
|
This tutorial was actually submitted to me to make into html for my tutorials archive... (Click link above)
Give me a few days, and I should have them both completed. I am almost done with the first.
|
Reply to this comment
|
13 July 2006, 00:27 GMT
|
|
Re: The Complete BASIC Optimization Guide
|
ericva1992
(Web Page)
|
This guide is nice! I knew some of the stuff, but learned a lot. I'm trying to get away from basic, but right now it's still the best choice. Just wanted to point out some things I saw:
1. You can put the \->\ character in a string, although it's sorta hard: type \->\ on the homescreen, hit enter, you'll get an error, just clear it out. Go into your Y=, in Y1 push 2nd-Entries to recall the last entry, which is \->\. Then just use str>equ. Doesn't cause any crashes, i think...
There is a more efficient way to do num>string using the linear regression, but i can't remember it right now
There is some bug in the 83+ OS that screws up using lowercase letters in inString(. Can't really figure it out.
|
Reply to this comment
|
13 July 2006, 19:53 GMT
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: The Complete BASIC Optimization Guide
|
ericva1992
(Web Page)
|
:Ans->\theta\
:{0,\theta\->L1
:{\theta\,0->L2
:LinReg(ax+b) \u\
:Equ>String(\u\,Str0
:sub(Str0,5,length(Str0)-4
It's hard to get smaller than that.
Handles decimals, Es, and negatives
But, for example, if you type 1E12 it will return 1000000000000 (equivalent). 1E15 and higher will return the number with the E in it.
The \u\ is the weird lowercase u equation variable you get by hitting second-7
|
Reply to this comment
|
16 July 2006, 00:30 GMT
|
|
|
|
|
|
|
|
Re: Re: Re: The Complete BASIC Optimization Guide
|
Arthur_ODwyer
(Web Page)
|
"However, if you do have the -> token in a string and you try to do an expr() function, it will give you an ERR: SYNTAX.."
That's just because you can't evaluate statements with expr(, period. expr( only works on expressions.
One thing I don't think it's possible to do in Basic, for example, is to ask the user for a variable or list name and then store new data into it. That's a pity; the most obvious application is "Enter a list name for your saved game..." Please, somebody, prove me wrong.
Also on the topic of expr(string), I just noticed that if Str1 contains "ABC" (including the quotes, via Equ>String or Input), then expr(Str1) gives an error, instead of returning the string ABC. That's odd.
One erratum to the Guide so far: In Section 5, the line "0\->\Xmin: 94\->\Xmax" should be replaced with "0\->\Xmin: 1\->\\DeltaX\". I plan to update the Guide in a couple of months, once I've had a chance to collect any more errata.
Thanks for all the comments (and praise :) !
Final blatant plug: Play and port my games! (Hold'em, World Empire, Dark Mage, Castle Adventure, and a new version of Hunt the Wumpus coming soon.)
|
Reply to this comment
|
14 July 2006, 21:37 GMT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Re: The Complete BASIC Optimization Guide
|
ericva1992
(Web Page)
|
I dunno if someone has found this out before, but it seems really weird to me. There are two ways of storing the "a" token (lowercase a), both are 2 bytes.
BB B0 <Normal way, you get this when you type Alpha-Alpha-a
62 16 <Weird way, no clue how I got it, probably from sending/recieving to my computer
Download JukeBox 2 (83+ BASIC Programs) and look at the hex for STR2LIST (DevTools). You'll see that in my InString string I use 62 16 for a, 62 17 for b, etc. But InString only cares about hex values, and since BB B0 is not the same as 62 16, it doesn't find it. This makes it possible to type
InString("a","a
and have it return 0.
|
Reply to this comment
|
18 July 2006, 22:00 GMT
|
|
Re: The Complete BASIC Optimization Guide
|
Weregoose
(Web Page)
|
The article is indeed brilliant. I insist that anyone who already calls himself competent in TI-Basic WILL learn from this guide. Read through it twice at least, and experiment always. It's ultimately one of the better paths to become the more advanced TI-Basic programmer you seek in yourself. Go at itread the darned thing. No one's holding you back but the person sitting down in your chair. :)
Goose
|
Reply to this comment
|
13 July 2006, 20:31 GMT
|
|
Re: The Complete BASIC Optimization Guide
|
Lewk Of Serthic
|
I've seen optimization guides before, but none as comprehensive as this, great job!
|
Reply to this comment
|
14 July 2006, 14:16 GMT
|
|
Re: The Complete BASIC Optimization Guide
|
Jonathan Pezzino
(Web Page)
|
It's great to see ticalc.org giving attention to BASIC Optimization! Many novice programmers have never even heard of the concept, and I think everybody benefits when these members improve their skills. It's also a stimulating read for those of us who are convinced we mastered BASIC long ago ;-).
This should be a good incentive to update the 1337 Guide!
|
Reply to this comment
|
15 July 2006, 17:36 GMT
|
|
1 2 3
You can change the number of comments per page in Account Preferences.
|