Adapting BASIC programs to run in Apple BASIC.

 

Who says that Apple Basic won't do the job?  Except for the
usual memory limitations (crowd 16K Star-Trek into an Apple I?)
our language is pretty comprehensive.  Which translates into
"Copy anyone's basic listing for a program".  The secret word
is ADAPT!  When the listing you try to copy won't run, don!t
curse and type "SCR". Instead, think of your computer as an
adaptable machine, and then ADAPT.

As an example, consider the following listing, as it might
appear in "101 Basic Games":
           10 IF RND(O)>0.8333 THEN 70

Adaption to Apple Basic becomes:

           10.IF RND(6)>4 THEN 70

Two-dimensional arrays are common in Basic program listings,
and require a solution to fit the program into our computers.  
The listing usually looks like this:

           1 DIM A(10,10)
               and...
           10 A (J,K)-B
        
To rearrange this to fit in Apple Basic, just multiply the
X and Y co-ordinates in the DIM statement to dimension the
array. (i.e. A(10,10) becomes A(100).)  Then, as the list
statements call for A(J,K), use the general form A((X-1)*J+K),
where X was the first number in the DIM statement. Our new
listing in the computer now reads:

           1 DIM A(100)
               and...
           10 A(9*J+K)=B

Another "stumper" is the statement:

           90 GO TO J 0F 260,270,280,290

But Apple basic will accept this statement:

           90 GO TO (250+10*J)

Which will do the same thing.

One more b it of advice.  When you manage to work around
some unusual coding that your Apple won't accept, write it


                                                  page 2


down.  Show what you have done alongside your hard-copy listing,
with all the reasons for doing it your new way.  Chances are
that you will run into this problem again.  There is no reason
for you to have to re-invent the solution.  Besides, maybe you
can help some other micro-freak when he has given up.

In fact, here's a challenge!  What is the best Apple-Basic
solution to the problem with the following program?


           75 DATA 13, 14, 15, 22, 23, 24, 29, 30, 31
           77 FOR W=1 to 9
           79 READ M
           81 B(M)=-7
           83 NEXT W

Send your solutions to Joe at the Apple Owners Club, and we'll
print the solutions that you send in.  So sit down now, put on
the old thinking cap, and tell the rest of us how dumb we are.  
We'll enjoy hearing from you.

Computer Type: 
Manufacturer: